Skip to content

Commit 52560f5

Browse files
committed
Merge branch 'feat_us_support' into 'dev'
Feat us support See merge request server/openapi/openapi-cpp-sdk!61
2 parents d3f0cc5 + d8a05f3 commit 52560f5

File tree

20 files changed

+100
-27
lines changed

20 files changed

+100
-27
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,5 @@ output/Mac/Release/*.a
8181
output/Linux/Debug/
8282
output/Linux/Release/
8383

84-
*.properties
84+
*.properties
85+
temp/

changlog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.1.0 (2025-08-08)
2+
### New
3+
- 支持 TBUS 配置
4+
15
## 1.0.4 (2025-05-12)
26
### Breaking
37
- 长连接订阅请求由 bool 改为 unsigned int,表示订阅请求的 id

demo/openapi_cpp_test/openapi_cpp_test.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class TestTradeClient {
180180
}
181181

182182
static void test_trade(const std::shared_ptr<TradeClient>& trade_client) {
183-
TestTradeClient::test_price_util(trade_client);
183+
TestTradeClient::test_place_order(trade_client);
184184
}
185185

186186
};
@@ -406,7 +406,7 @@ class TestQuoteClient {
406406

407407

408408
static void test_quote(const std::shared_ptr<QuoteClient> quote_client) {
409-
TestQuoteClient::test_get_quote_delay(quote_client);
409+
TestQuoteClient::test_get_kline(quote_client);
410410
}
411411
};
412412

@@ -454,7 +454,8 @@ class TestPushClient {
454454
TestPushClient(std::shared_ptr<IPushClient> client) : push_client(client) {
455455
std::vector<std::string> hk_option_symbols = {"TCH.HK 20241230 410.00 CALL"};
456456
std::vector<std::string> future_symbols = {"CL2412"};
457-
symbols = future_symbols;
457+
std::vector<std::string> stock_symbols = {"AAPL", "TSLA"};
458+
symbols = stock_symbols;
458459
}
459460

460461
void connected_callback() {
@@ -613,20 +614,20 @@ int main(int argc, char* argv[]) {
613614
//config.lang = U("en_US");
614615

615616
//Create a push client instance
616-
auto push_client = IPushClient::create_push_client(config);
617-
TestPushClient::test_push_client(push_client, config);
617+
//auto push_client = IPushClient::create_push_client(config);
618+
//TestPushClient::test_push_client(push_client, config);
618619

619620
/**
620621
* QuoteClient
621622
*/
622-
// std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
623-
// TestQuoteClient::test_quote(quote_client);
623+
std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
624+
TestQuoteClient::test_quote(quote_client);
624625

625626
/**
626627
* TradeClient
627628
*/
628-
//std::shared_ptr<TradeClient> trade_client = std::make_shared<TradeClient>(config);
629-
//TestTradeClient::test_trade(trade_client);
629+
// std::shared_ptr<TradeClient> trade_client = std::make_shared<TradeClient>(config);
630+
// TestTradeClient::test_trade(trade_client);
630631

631632
/**
632633
* TigerApi

demo/openapi_cpp_test/openapi_cpp_test.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@
193193
<SDLCheck>true</SDLCheck>
194194
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
195195
<ConformanceMode>true</ConformanceMode>
196-
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
196+
<AdditionalIncludeDirectories>..\vcpkg\installed\x64-windows\include;..\..\include</AdditionalIncludeDirectories>
197197
</ClCompile>
198198
<Link>
199199
<SubSystem>Console</SubSystem>
200200
<GenerateDebugInformation>true</GenerateDebugInformation>
201-
<AdditionalLibraryDirectories>..\..\\output\Windows\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
201+
<AdditionalLibraryDirectories>..\vcpkg\installed\x64-windows\lib;..\..\\output\Windows\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
202202
<AdditionalDependencies>openapi-cpp-sdk.lib;cpprest_2_10d.lib;libprotobufd.lib</AdditionalDependencies>
203203
</Link>
204204
</ItemDefinitionGroup>

include/tigerapi/client_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ namespace TIGER_API {
6060

6161
const utility::string_t& get_socket_port();
6262

63+
bool is_us();
64+
6365
private:
6466
bool sandbox_debug = false;
6567
utility::string_t server_url = TIGER_SERVER_URL;

include/tigerapi/constants.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,22 @@ static utility::string_t SANDBOX_TIGER_PUBLIC_KEY = U("MIGfMA0GCSqGSIb3DQEBAQUAA
7373
"MidihTvHHf+tJ0PYD0o3PruI0hl3qhEjHTAxb75T5YD3SGK4IBhHn/Rk6mhqlGgI+bBrBVYaXixm"
7474
"HfRo75RpUUuWACyeqQkZckgR0McxuW9xRMIa2cXZOoL1E4SL4lXKGhKoWbwIDAQAB");
7575

76+
static utility::string_t TIGER_HOST = U("openapi.tigerfintech.com");
77+
static utility::string_t SANDBOX_TIGER_HOST = U("openapi-sandbox.tigerfintech.com");
78+
static utility::string_t US_TIGER_HOST = U("openapi.tradeup.com");
79+
7680
/** HTTP interface service address **/
77-
static utility::string_t TIGER_SERVER_URL = U("https://openapi.tigerfintech.com/gateway");
78-
static utility::string_t SANDBOX_TIGER_SERVER_URL = U("https://openapi-sandbox.tigerfintech.com/gateway");
81+
static utility::string_t TIGER_SERVER_URL = U("https://") + TIGER_HOST + U("/gateway");
82+
static utility::string_t SANDBOX_TIGER_SERVER_URL = U("https://") + SANDBOX_TIGER_HOST + U("/gateway");
83+
static utility::string_t US_TIGER_SERVER_URL = U("https://") + US_TIGER_HOST + U("/gateway");
7984

8085
/** Push service address **/
81-
static utility::string_t TIGER_SOCKET_HOST = U("openapi.tigerfintech.com");
82-
static utility::string_t SANDBOX_TIGER_SOCKET_HOST = U("openapi-sandbox.tigerfintech.com");
86+
static utility::string_t TIGER_SOCKET_HOST = TIGER_HOST;
87+
static utility::string_t SANDBOX_TIGER_SOCKET_HOST = SANDBOX_TIGER_HOST;
88+
static utility::string_t US_TIGER_SOCKET_HOST = US_TIGER_HOST;
8389
static utility::string_t TIGER_SOCKET_PORT = U("9883");
8490
static utility::string_t SANDBOX_TIGER_SOCKET_PORT = U("9885");
91+
static utility::string_t US_TIGER_SOCKET_PORT = U("9983");
8592

8693
#define DEFAULT_TOKEN_FILE U("tiger_openapi_token.properties")
8794
#define DEFAULT_PROPS_FILE U("tiger_openapi_config.properties")

include/tigerapi/enums.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,30 @@ namespace TIGER_API {
4141
}
4242
}
4343

44+
enum class License {
45+
TBNZ,
46+
TBSG,
47+
TBHK,
48+
TBAU,
49+
TBUS
50+
};
51+
52+
inline utility::string_t enum_to_str(License license) {
53+
switch (license) {
54+
case License::TBNZ:
55+
return U("TBNZ");
56+
case License::TBSG:
57+
return U("TBSG");
58+
case License::TBHK:
59+
return U("TBHK");
60+
case License::TBAU:
61+
return U("TBAU");
62+
case License::TBUS:
63+
return U("TBUS");
64+
default:
65+
return U("");
66+
}
67+
}
4468

4569
enum class TradingSession {
4670
PreMarket, // PreMarket

include/tigerapi/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
#ifndef TIGERAPI_VERSION_H
66
#define TIGERAPI_VERSION_H
77

8-
#define PROJECT_VERSION "1.0.4"
8+
#define PROJECT_VERSION "1.1.0"
99

1010
#endif //TIGERAPI_VERSION_H

0 commit comments

Comments
 (0)