forked from lxjwolf/V3-Open-API-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 996862e
Showing
1,771 changed files
with
248,520 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# OKcoin Open API V3 SDK | ||
### API Support | ||
|
||
|联系我们|Contact Us|| | ||
|---|---|---| | ||
|微信号|WeChat ID|ApiSupport| | ||
|邮 箱|E-mail|[email protected]| | ||
|
||
### Supported language: Java, Python, C#, C++, Go | ||
--- | ||
|
||
|list|language|comment| | ||
|---|---|---| | ||
|okex-java-sdk-api|Java|-| | ||
|okex-python-sdk-api|Python|-| | ||
|okex-cs-sdk-api|C#|-| | ||
|okex-cpp-sdk-api|C++|-| | ||
|okex-go-sdk-api|Go|-| |
Submodule okex-api-v3-node-sdk
added at
e39f33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
.idea | ||
logs | ||
transaction-logs | ||
target/ | ||
.mvn/ | ||
**/.DS_Store | ||
build/ | ||
libs/cpprestsdk/build.debug | ||
### IntelliJ IDEA ### | ||
.idea/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
.classpath | ||
.project | ||
.settings | ||
#logs | ||
/logs/ | ||
/transaction-logs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
project(okapi) | ||
|
||
# Configure required libraries ... | ||
if(UNIX) # Darwing or Linux | ||
|
||
find_package(Boost REQUIRED COMPONENTS system thread log program_options chrono) | ||
find_package(Threads REQUIRED) | ||
|
||
if(APPLE) | ||
# Prefer a homebrew version of OpenSSL over the one in /usr/lib | ||
file(GLOB OPENSSL_ROOT_DIR /usr/local/Cellar/openssl/*) | ||
# Prefer the latest (make the latest one first) | ||
list(REVERSE OPENSSL_ROOT_DIR) | ||
|
||
find_package(OpenSSL 1.0.2 REQUIRED) | ||
set(OPENSSL_VERSION "1.0.2f") | ||
else() | ||
find_package(OpenSSL 1.0.1 REQUIRED) | ||
set(OPENSSL_VERSION "1.0.1") | ||
endif() | ||
|
||
elseif(WIN32) # Windows systems including Win64. | ||
message(FATAL_ERROR "-- Windows is not supported for now.") | ||
else() | ||
message(FATAL_ERROR "-- Unsupported platform sorry! :( ") | ||
endif() | ||
|
||
# Configure compiler options ... | ||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
|
||
message("-- configuring clang options") | ||
set(CMAKE_CXX_FLAGS "-arch x86_64 -std=c++11 -stdlib=libc++ -DBOOST_LOG_DYN_LINK -Wno-deprecated-declarations") | ||
|
||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||
|
||
message("-- configuring gcc options") | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -DBOOST_LOG_DYN_LINK") | ||
|
||
endif() | ||
|
||
# Project construction ... | ||
|
||
# source files ... | ||
add_executable(${PROJECT_NAME} source/main.cpp source/swap.cpp source/okapi_ws.h source/okapi_ws.cpp source/base64.hpp | ||
source/okapi.cpp source/okapi.h source/algo_hmac.h source/algo_hmac.cpp source/constants.h | ||
source/futures_api.cpp source/account_api.cpp source/utils.h source/utils.cpp source/spot/margin_account_api.cpp | ||
source/spot/margin_order_api.cpp source/spot/spot_account_api.cpp source/spot/spot_order_api.cpp source/spot/spot_product_api.cpp | ||
source/ett_api.cpp) | ||
|
||
# headers search paths ... | ||
set(CPPRESTSDK_INCLUDE_DIR "./libs/cpprestsdk/Release/include") | ||
set(MICROSERVICE_INCLUDE_DIR "./source/foundation/include") | ||
message(MICROSERVICE " ${MICROSERVICE_INCLUDE_DIR}") | ||
set(HEADER_SEARCH_PATHS ${CPPRESTSDK_INCLUDE_DIR} ${MICROSERVICE_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR}) | ||
|
||
# library search paths ... | ||
if(APPLE) | ||
set(OPENSSL_LIBS "/usr/local/Cellar/openssl/${OPENSSL_VERSION}/lib/libssl.1.0.0.dylib;/usr/local/Cellar/openssl/${OPENSSL_VERSION}/lib/libcrypto.1.0.0.dylib") | ||
set(CPPRESTSDK_LIBRARY "${PROJECT_SOURCE_DIR}/libs/cpprestsdk/build.debug/Binaries/libcpprest.a") | ||
set(ZIP_LIBRARY "/usr/local/Cellar/zlib/1.2.11/lib/libz.dylib") | ||
|
||
set(LIBRARIES_SEARCH_PATHS ${OPENSSL_LIBS} ${Boost_LIBRARIES} ${CPPRESTSDK_LIBRARY} ${ZIP_LIBRARY}) | ||
else() | ||
set(OPENSSL_LIBS "${OPENSSL_LIBRARIES}") | ||
set(CPPRESTSDK_LIBRARY "${PROJECT_SOURCE_DIR}/libs/cpprestsdk/build.debug/Binaries/libcpprest.a") | ||
|
||
set(LIBRARIES_SEARCH_PATHS ${CPPRESTSDK_LIBRARY} ${OPENSSL_LIBS} ${Boost_LIBRARIES}) | ||
endif() | ||
|
||
message(BOOST_LIBS " ${Boost_LIBRARIES}") | ||
message(OPENSSL_LIBS " ${OPENSSL_LIBRARIES}") | ||
message(CPPRESTSDK_LIBRARY " ${CPPRESTSDK_LIBRARY}") | ||
message(ZLIB_LIBRARY " ${ZLIB_LIBRARY}") | ||
message(LIBRARIES_SEARCH_PATHS " ${LIBRARIES_SEARCH_PATHS}") | ||
|
||
include_directories(${HEADER_SEARCH_PATHS}) | ||
if (APPLE) | ||
target_link_libraries(${PROJECT_NAME} "-framework CoreFoundation") | ||
target_link_libraries(${PROJECT_NAME} "-framework Security") | ||
target_link_libraries(${PROJECT_NAME} ${LIBRARIES_SEARCH_PATHS}) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-W1, -F/Library/Frameworks") | ||
else() | ||
target_link_libraries(${PROJECT_NAME} ${LIBRARIES_SEARCH_PATHS}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# okapi | ||
This is a sample that shows how to use okapi on C++ using the C++ REST SDK | ||
|
||
## How to build | ||
|
||
1. Install git, CMake, boost, openssl on your system, if you are using macOS this can be acomplished easily with the following command: | ||
|
||
$ brew install cmake git openssl boost zlib | ||
|
||
if you are using Ubuntu this can be acomplished easily with the following command: | ||
|
||
$ sudo apt-get install cmake git openssl libboost-all-dev zlib1g zlib1g.dev | ||
2. Clone the repository. | ||
3. Go to the directory ./libs and execute the script: ```./build_dependencies.sh``` that'll clone the [C++ REST SDK](https://github.com/Microsoft/cpprestsdk) repository and will build the static version of the library, if you want to build the dynamic link version of the library just on the **build_dependencies.sh** script remove the flag: ```-DBUILD_SHARED_LIBS=OFF```. | ||
4. Go to the directory cppsdk and type the following commands: | ||
|
||
$ mkdir build | ||
$ cd build | ||
$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug .. | ||
|
||
5. Set config.SecretKey, config.ApiKey and config.Passphrase in the main function in main.cpp | ||
6. Finally type the command: | ||
|
||
$ make -j 8 | ||
7. On ```./build``` directory type and you should see the following output: | ||
|
||
$ ./okapi | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
RESTSDK_VERSION="v2.9.1" | ||
DEFAULT_LIB_DIRECTORY_PATH="." | ||
|
||
libDir=${1:-$DEFAULT_LIB_DIRECTORY_PATH} | ||
|
||
|
||
install_cpprestsdk(){ | ||
restsdkDir="$libDir/cpprestsdk" | ||
restsdkBuildDir="$restsdkDir/build.debug" | ||
|
||
mkdir "$restsdkBuildDir" | ||
|
||
(cd "$restsdkBuildDir" && cmake ../Release -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF) | ||
(cd "$restsdkBuildDir" && make -j 7) | ||
} | ||
|
||
mkdir -p "$libDir" | ||
|
||
install_cpprestsdk |
173 changes: 173 additions & 0 deletions
173
okex-cpp-sdk-api/libs/cpprestsdk/Build_android/boost-for-android-x86.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
diff --git a/build-android.sh b/build-android.sh | ||
index 40453f7..5902fe2 100755 | ||
--- a/build-android.sh | ||
+++ b/build-android.sh | ||
@@ -195,8 +195,12 @@ case "$HOST_OS" in | ||
PlatformOS=linux | ||
esac | ||
|
||
+NDK_SOURCE_PROPERTIES=$AndroidNDKRoot"/source.properties" | ||
NDK_RELEASE_FILE=$AndroidNDKRoot"/RELEASE.TXT" | ||
-if [ -f "${NDK_RELEASE_FILE}" ]; then | ||
+if [ -f "${NDK_SOURCE_PROPERTIES}" ]; then | ||
+ version=$(grep -i '^Pkg.Revision =' $NDK_SOURCE_PROPERTIES | cut -f2- -d=) | ||
+ NDK_RN=$(echo $version | awk -F. '{print $1}') | ||
+elif [ -f "${NDK_RELEASE_FILE}" ]; then | ||
NDK_RN=`cat $NDK_RELEASE_FILE | sed 's/^r\(.*\)$/\1/g'` | ||
elif [ -n "${AndroidSourcesDetected}" ]; then | ||
if [ -f "${ANDROID_BUILD_TOP}/ndk/docs/CHANGES.html" ]; then | ||
@@ -258,10 +262,20 @@ case "$NDK_RN" in | ||
TOOLSET=gcc-androidR8e | ||
;; | ||
"10 (64-bit)") | ||
- TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.6} | ||
- CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/arm-linux-androideabi-g++ | ||
- TOOLSET=gcc-androidR8e | ||
+ TOOLCHAIN=llvm-3.4 | ||
+ CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/clang++ | ||
+ TOOLSET=clang-androidR8e | ||
+ ;; | ||
+ "10e-rc4 (64-bit)"|"10e (64-bit)") | ||
+ TOOLCHAIN=llvm-3.6 | ||
+ CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/clang++ | ||
+ TOOLSET=clang-androidR8e | ||
;; | ||
+ 11) | ||
+ TOOLCHAIN=llvm | ||
+ CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/clang++ | ||
+ TOOLSET=clang-androidR8e | ||
+ ;; | ||
*) | ||
echo "Undefined or not supported Android NDK version!" | ||
exit 1 | ||
@@ -391,6 +405,7 @@ echo "Building boost for android" | ||
export AndroidBinariesPath=`dirname $CXXPATH` | ||
export PATH=$AndroidBinariesPath:$PATH | ||
export AndroidNDKRoot | ||
+ export PlatformOS | ||
export NO_BZIP2=1 | ||
|
||
cxxflags="" | ||
@@ -405,7 +420,7 @@ echo "Building boost for android" | ||
--layout=versioned \ | ||
--prefix="./../$BUILD_DIR/" \ | ||
$LIBRARIES \ | ||
- install 2>&1 \ | ||
+ release debug install 2>&1 \ | ||
|| { dump "ERROR: Failed to build boost for android!" ; exit 1 ; } | ||
} | tee -a $PROGDIR/build.log | ||
|
||
diff --git a/configs/user-config-boost-1_55_0.jam b/configs/user-config-boost-1_55_0.jam | ||
index 666d4c8..93aba68 100644 | ||
--- a/configs/user-config-boost-1_55_0.jam | ||
+++ b/configs/user-config-boost-1_55_0.jam | ||
@@ -39,93 +39,47 @@ | ||
|
||
import os ; | ||
local AndroidNDKRoot = [ os.environ AndroidNDKRoot ] ; | ||
+local PlatformOS = [ os.environ PlatformOS ] ; | ||
|
||
# -------------------------------------------------------------------- | ||
-# Is same for 8b, 8c and 8d | ||
-using gcc : androidR8b | ||
+using clang : androidR8e | ||
: | ||
-arm-linux-androideabi-g++ | ||
+$(AndroidNDKRoot)/toolchains/llvm/prebuilt/$(PlatformOS)-x86_64/bin/clang++ | ||
: | ||
-<archiver>arm-linux-androideabi-ar | ||
+<compileflags>--gcc-toolchain="$(AndroidNDKRoot)/toolchains/x86-4.9/prebuilt/$(PlatformOS)-x86_64" | ||
<compileflags>-fexceptions | ||
<compileflags>-frtti | ||
<compileflags>-fpic | ||
<compileflags>-ffunction-sections | ||
<compileflags>-funwind-tables | ||
-<compileflags>-D__ARM_ARCH_5__ | ||
-<compileflags>-D__ARM_ARCH_5T__ | ||
-<compileflags>-D__ARM_ARCH_5E__ | ||
-<compileflags>-D__ARM_ARCH_5TE__ | ||
-<compileflags>-Wno-psabi | ||
-<compileflags>-march=armv5te | ||
-<compileflags>-mtune=xscale | ||
-<compileflags>-msoft-float | ||
-<compileflags>-mthumb | ||
+<compileflags>-fstack-protector | ||
+<compileflags>-no-canonical-prefixes | ||
+<compileflags>--target=i686-none-linux-android | ||
+<compileflags>--sysroot="$(AndroidNDKRoot)/platforms/android-9/arch-x86" | ||
<compileflags>-Os | ||
<compileflags>-fomit-frame-pointer | ||
-<compileflags>-fno-strict-aliasing | ||
-<compileflags>-finline-limit=64 | ||
-<compileflags>-I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include | ||
+<compileflags>-fstrict-aliasing | ||
<compileflags>-Wa,--noexecstack | ||
<compileflags>-DANDROID | ||
<compileflags>-D__ANDROID__ | ||
<compileflags>-DNDEBUG | ||
<compileflags>-O2 | ||
<compileflags>-g | ||
-<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include | ||
-<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include | ||
+<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/include | ||
+<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include | ||
+<linkflags>--target=i686-none-linux-android | ||
+<linkflags>--gcc-toolchain="$(AndroidNDKRoot)/toolchains/x86-4.9/prebuilt/$(PlatformOS)-x86_64" | ||
+<linkflags>--sysroot=$(AndroidNDKRoot)/platforms/android-9/arch-x86 | ||
# @Moss - Above are the 'oficial' android flags | ||
-<architecture>arm | ||
+<architecture>i686 | ||
<compileflags>-fvisibility=hidden | ||
<compileflags>-fvisibility-inlines-hidden | ||
<compileflags>-fdata-sections | ||
-<cxxflags>-D__arm__ | ||
<cxxflags>-D_REENTRANT | ||
<cxxflags>-D_GLIBCXX__PTHREADS | ||
+<cxxflags>-std=c++11 | ||
; | ||
|
||
-# -------------------------------------------------------------------- | ||
-using gcc : androidR8e | ||
-: | ||
-arm-linux-androideabi-g++ | ||
-: | ||
-<archiver>arm-linux-androideabi-ar | ||
-<compileflags>-fexceptions | ||
-<compileflags>-frtti | ||
-<compileflags>-fpic | ||
-<compileflags>-ffunction-sections | ||
-<compileflags>-funwind-tables | ||
-<compileflags>-D__ARM_ARCH_5__ | ||
-<compileflags>-D__ARM_ARCH_5T__ | ||
-<compileflags>-D__ARM_ARCH_5E__ | ||
-<compileflags>-D__ARM_ARCH_5TE__ | ||
-<compileflags>-Wno-psabi | ||
-<compileflags>-march=armv5te | ||
-<compileflags>-mtune=xscale | ||
-<compileflags>-msoft-float | ||
-<compileflags>-mthumb | ||
-<compileflags>-Os | ||
-<compileflags>-fomit-frame-pointer | ||
-<compileflags>-fno-strict-aliasing | ||
-<compileflags>-finline-limit=64 | ||
-<compileflags>-I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include | ||
-<compileflags>-Wa,--noexecstack | ||
-<compileflags>-DANDROID | ||
-<compileflags>-D__ANDROID__ | ||
-<compileflags>-DNDEBUG | ||
-<compileflags>-O2 | ||
-<compileflags>-g | ||
-<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include | ||
-<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include | ||
-# @Moss - Above are the 'oficial' android flags | ||
-<architecture>arm | ||
-<compileflags>-fvisibility=hidden | ||
-<compileflags>-fvisibility-inlines-hidden | ||
-<compileflags>-fdata-sections | ||
-<cxxflags>-D__arm__ | ||
-<cxxflags>-D_REENTRANT | ||
-<cxxflags>-D_GLIBCXX__PTHREADS | ||
-; | ||
|
||
|
||
# ------------------ |
Oops, something went wrong.