Skip to content

Commit 3be5d00

Browse files
committed
Merge branch 'dev_tcp_client_chengxin' into 'feature_tcp_client'
【ADD】openapi c++ sdk 增加pb格式的数据 See merge request server/openapi/openapi-cpp-sdk!11
2 parents abe7ccc + 48c189e commit 3be5d00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+44111
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
syntax = "proto3";
2+
3+
package tigeropen.push.pb;
4+
5+
6+
message AssetData {
7+
string account = 1; // user account
8+
string currency = 2; // currency. USD, HKD, etc.
9+
string segType = 3; // Securities Category C: (Commodities Futures), S: (Securities Stocks)
10+
11+
double availableFunds = 4; // available funds, overnight liquidity
12+
double excessLiquidity = 5; // excess liquidity, used to represent intraday risk value.
13+
double netLiquidation = 6; // Total Assets (Net Liquidation Value)
14+
double equityWithLoan = 7; // Equity with loan value (asset with loan value) - Securities Segment: Cash Value + Stock Value - Futures Segment: Cash Value - Maintenance Margin
15+
double buyingPower = 8; // buying power. An estimation of how many more dollars you can buy in stock assets. Only apply to stock segment
16+
double cashBalance = 9; // Cash amount. Sum of current cash balances in all currencies
17+
double grossPositionValue = 10; // total value of securities
18+
19+
double initMarginReq = 11; // initial margin requirement
20+
double maintMarginReq = 12; // maintenance margin requirement
21+
uint64 timestamp = 13;
22+
23+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
syntax = "proto3";
2+
package tigeropen.push.pb;
3+
4+
message KlineData {
5+
int64 time = 1; // bar timestamp.
6+
float open = 2; // The first transaction price of current minute.
7+
float high = 3; // The highest price of current minute.
8+
float low = 4; // The lowest price of current minute.
9+
float close = 5; // The last transaction price in the current minute
10+
float avg = 6; // The average price of current minute.
11+
int64 volume = 7; // Cumulative trading volume in current minute.
12+
int32 count = 8; // The number of transaction in current minute.
13+
string symbol = 9; // symbol
14+
double amount = 10; // Cumulative turnover in current minute.
15+
uint64 serverTimestamp = 11;
16+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
syntax = "proto3";
2+
3+
package tigeropen.push.pb;
4+
5+
message OptionTopData {
6+
string market = 1;
7+
int64 timestamp = 2;
8+
repeated TopData topData = 3;
9+
10+
message TopData {
11+
string targetName = 1; // bigOrder, volume, amount, openInt
12+
repeated BigOrder bigOrder = 2; // large order(bigOrder)
13+
repeated OptionItem item = 3; // target value top list(volume, amount, openInt)
14+
}
15+
16+
message BigOrder {
17+
string symbol = 1;
18+
string expiry = 2; // formate:yyyyMMdd
19+
string strike = 3; // strike price
20+
string right = 4; // CALL/PUT
21+
string dir = 5; // BUY/SELL
22+
double volume = 6; // target value: volume > 1000
23+
double price = 7; // trade price
24+
double amount = 8; // trade amount
25+
int64 tradeTime = 9;// trade timestamp
26+
}
27+
28+
message OptionItem {
29+
string symbol = 1;
30+
string expiry = 2; // formate:yyyyMMdd
31+
string strike = 3; // strike price
32+
string right = 4; // CALL/PUT
33+
double totalAmount = 5; // total trade amount
34+
double totalVolume = 6; // total trade volume
35+
double totalOpenInt = 7; // open interest
36+
double volumeToOpenInt = 8; // Volume to Open Interest
37+
double latestPrice = 9; // option latest price
38+
int64 updateTime = 10; // uptate timestamp
39+
}
40+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
syntax = "proto3";
2+
3+
package tigeropen.push.pb;
4+
5+
message OrderStatusData {
6+
sint64 id = 1; // unique order id
7+
string account = 2; // user account
8+
string symbol = 3;
9+
string expiry = 4; // for options, formate:yyyyMMdd
10+
string strike = 5; // for options
11+
string right = 6; // for options
12+
string identifier = 7;
13+
uint32 multiplier = 8; // multiplier for futures, options, warrants and CBBC
14+
string action = 9; // BUY or SELL
15+
string market = 10; // market. US, HK, etc.
16+
string currency = 11; // currency. USD, HKD, etc.
17+
string segType = 12; // Securities Category C: (Commodities Futures), S: (Securities Stocks)
18+
string secType = 13; // STK Stocks, OPT Options, WAR Warrants, IOPT CBBC, CASH FOREX, FUT Futures, FOP Future Options
19+
20+
string orderType = 14; // order type
21+
bool isLong = 15;
22+
sint64 totalQuantity = 16; // total quantity
23+
sint32 totalQuantityScale = 17; // total quantity scale
24+
sint64 filledQuantity = 18; // filled quantity
25+
sint32 filledQuantityScale = 19; // filled quantity scale
26+
double avgFillPrice = 20; // average price at which the orders got filled
27+
double limitPrice = 21; // limit price(required when orderType is 'LMT')
28+
double stopPrice = 22; // stop price(required when orderType is 'STP')
29+
double realizedPnl = 23; // realized profit and loss
30+
string status = 24; // order status
31+
string replaceStatus = 25; // order replace status
32+
string cancelStatus = 26; // order cancel status
33+
34+
bool outsideRth = 27; // if trade outside regular trading hours (only applicable to U.S. market)
35+
bool canModify = 28;
36+
bool canCancel = 29;
37+
bool liquidation = 30;
38+
string name = 31; // symbol name
39+
string source = 32; // order source(from 'OpenApi', or not)
40+
string errorMsg = 33; // error message
41+
string attrDesc = 34; // order description
42+
float commissionAndFee = 35; // commission and fee
43+
uint64 openTime = 36; // timestamp when the order is placed
44+
uint64 timestamp = 37;
45+
string userMark = 38;
46+
double totalCashAmount = 39;
47+
double filledCashAmount = 40;
48+
double gst = 41;
49+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
syntax = "proto3";
2+
3+
package tigeropen.push.pb;
4+
5+
message OrderTransactionData {
6+
sint64 id = 1; // transact id
7+
sint64 orderId = 2; // unique order id
8+
string account = 3; // user account
9+
string symbol = 4;
10+
string identifier = 5;
11+
uint32 multiplier = 6; // multiplier for futures, options, warrants and CBBC
12+
string action = 7; // BUY or SELL
13+
string market = 8; // market. US, HK, etc.
14+
string currency = 9; // currency. USD, HKD, etc.
15+
string segType = 10; // Securities Category C: (Commodities Futures), S: (Securities Stocks)
16+
string secType = 11; // STK Stocks, OPT Options, WAR Warrants, IOPT CBBC, CASH FOREX, FUT Futures, FOP Future Options
17+
double filledPrice = 12; // filled price
18+
sint64 filledQuantity = 13; // filled quantity
19+
uint64 createTime = 14;
20+
uint64 updateTime = 15;
21+
uint64 transactTime = 16; // transact time
22+
uint64 timestamp = 17;
23+
24+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
syntax = "proto3";
2+
3+
package tigeropen.push.pb;
4+
5+
message PositionData {
6+
string account = 1; // user account
7+
string symbol = 2;
8+
string expiry = 3; // for options
9+
string strike = 4; // for options
10+
string right = 5; // for options
11+
string identifier = 6;
12+
uint32 multiplier = 7; // multiplier for futures, options, warrants and CBBC
13+
string market = 8; // market. US, HK, etc.
14+
string currency = 9; // currency. USD, HKD, etc.
15+
string segType = 10; // Securities Category C: (Commodities Futures), S: (Securities Stocks)
16+
string secType = 11; // STK Stocks, OPT Options, WAR Warrants, IOPT CBBC, CASH FOREX, FUT Futures, FOP Future Options
17+
18+
sint64 position = 12; // total position
19+
sint32 positionScale = 13; // total position scale
20+
double averageCost = 14; // average holding cost
21+
double latestPrice = 15; // last price of the asset
22+
double marketValue = 16; // market value of the asset
23+
double unrealizedPnl = 17; // unrealized profit and loss
24+
string name = 18; // symbol name
25+
uint64 timestamp = 19;
26+
sint64 saleable = 20; // saleable quantity for Chinese A-share market stocks
27+
double positionQty = 21; // total position quantity
28+
double salableQty = 22; // saleable quantity
29+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
syntax = "proto3";
2+
import public "SocketCommon.proto";
3+
import public "OrderStatusData.proto";
4+
import public "PositionData.proto";
5+
import public "AssetData.proto";
6+
import public "QuoteData.proto";
7+
import public "QuoteDepthData.proto";
8+
import public "TradeTickData.proto";
9+
import public "OrderTransactionData.proto";
10+
import public "StockTopData.proto";
11+
import public "OptionTopData.proto";
12+
import public "KlineData.proto";
13+
import public "TickData.proto";
14+
15+
package tigeropen.push.pb;
16+
17+
message PushData {
18+
SocketCommon.DataType dataType = 1;
19+
oneof body {
20+
QuoteData quoteData = 2;
21+
QuoteDepthData quoteDepthData = 3;
22+
TradeTickData tradeTickData = 4;
23+
PositionData positionData = 5;
24+
AssetData assetData = 6;
25+
OrderStatusData orderStatusData = 7;
26+
OrderTransactionData orderTransactionData = 8;
27+
StockTopData stockTopData = 9;
28+
OptionTopData optionTopData = 10;
29+
KlineData klineData = 11;
30+
TickData tickData = 12;
31+
}
32+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
syntax = "proto3";
2+
import public "SocketCommon.proto";
3+
4+
package tigeropen.push.pb;
5+
6+
7+
message QuoteBBOData {
8+
9+
string symbol = 1;
10+
SocketCommon.QuoteType type = 2; // BBO
11+
uint64 timestamp = 3;
12+
13+
double askPrice = 17;
14+
sint64 askSize = 18;
15+
uint64 askTimestamp = 19; // Pre/Post-Mkt data not support
16+
double bidPrice = 20;
17+
sint64 bidSize = 21;
18+
uint64 bidTimestamp = 22; // Pre/Post-Mkt data not support
19+
20+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
syntax = "proto3";
2+
import public "SocketCommon.proto";
3+
import public "QuoteData.proto";
4+
5+
package tigeropen.push.pb;
6+
7+
message QuoteBasicData {
8+
9+
string symbol = 1;
10+
SocketCommon.QuoteType type = 2; // BASIC/BBO
11+
uint64 timestamp = 3;
12+
uint64 serverTimestamp = 4;
13+
double avgPrice = 5; // Options data not support
14+
double latestPrice = 6; //
15+
uint64 latestPriceTimestamp = 7; // Pre/Post-Mkt data not support
16+
string latestTime = 8; //
17+
double preClose = 9; //
18+
sint64 volume = 10; //
19+
double amount = 11; // Futures and Options data not support
20+
21+
double open = 12; // Pre/Post-Mkt data not support
22+
double high = 13; // Pre/Post-Mkt data not support
23+
double low = 14; // Pre/Post-Mkt data not support
24+
25+
string hourTradingTag = 15; // Pre/Post-Mkt
26+
string marketStatus = 16;
27+
28+
string identifier = 23; // only Options support
29+
sint64 openInt = 24; // open interest, only Options support
30+
31+
uint64 tradeTime = 25; // latest trad time, only Futures support
32+
double preSettlement = 26; // previous settlement price, only Futures support
33+
float minTick = 27; // min tick, only Futures support
34+
35+
// minute data: price, average price, time, volume
36+
QuoteData.Minute mi = 28;
37+
38+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
syntax = "proto3";
2+
package tigeropen.push.pb;
3+
4+
import "SocketCommon.proto";
5+
6+
7+
8+
message QuoteData {
9+
10+
string symbol = 1;
11+
SocketCommon.QuoteType type = 2; // ALL/BASIC/BBO
12+
uint64 timestamp = 3;
13+
uint64 serverTimestamp = 4;
14+
double avgPrice = 5; // Options data not support
15+
double latestPrice = 6; // required when type is 'BASIC'
16+
uint64 latestPriceTimestamp = 7; // required when type is 'BASIC', Pre/Post-Mkt data not support
17+
string latestTime = 8; // required when type is 'BASIC'
18+
double preClose = 9; // required when type is 'BASIC'
19+
sint64 volume = 10; // required when type is 'BASIC'
20+
double amount = 11; // required when type is 'BASIC', Futures and Options data not support
21+
22+
double open = 12; // required when symbol in HK market
23+
double high = 13; // required when symbol in HK market
24+
double low = 14; // required when symbol in HK market
25+
26+
string hourTradingTag = 15; // Pre/Post-Mkt
27+
string marketStatus = 16;
28+
29+
double askPrice = 17; // required when type is 'BBO'
30+
sint64 askSize = 18; // required when type is 'BBO'
31+
uint64 askTimestamp = 19; // Pre/Post-Mkt data not support
32+
double bidPrice = 20; // required when type is 'BBO'
33+
sint64 bidSize = 21; // required when type is 'BBO'
34+
uint64 bidTimestamp = 22; // Pre/Post-Mkt data not support
35+
36+
string identifier = 23; // only Options support
37+
sint64 openInt = 24; // open interest, only Options support
38+
39+
uint64 tradeTime = 25; // latest trad time, only Futures support
40+
double preSettlement = 26; // previous settlement price, only Futures support
41+
float minTick = 27; // min tick, only Futures support
42+
43+
// minute data: price, average price, time, volume
44+
Minute mi = 28;
45+
46+
message Minute {
47+
double p = 1; // last price of the minute bar
48+
double a = 2; // average price of the minute bar
49+
uint64 t = 3; // timestamp of the minute bar
50+
sint64 v = 4; // trading volume of the minute bar
51+
double o = 5; // open price of the minute bar
52+
double h = 6; // highest price of the minute bar
53+
double l = 7; // lowest price of the minute bar
54+
}
55+
}

0 commit comments

Comments
 (0)