Skip to content

Commit

Permalink
Merge pull request #441 from crypto-chassis/dev
Browse files Browse the repository at this point in the history
dev: add a few missing fields for binance GET_INSTRUMENTS
  • Loading branch information
cryptochassis committed Oct 20, 2023
2 parents 7c45df3 + 62813f9 commit 96ac149
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/ccapi_cpp/ccapi_macro.h
Expand Up @@ -265,6 +265,9 @@
#ifndef CCAPI_ORDER_QUANTITY_MIN
#define CCAPI_ORDER_QUANTITY_MIN "QUANTITY_MIN"
#endif
#ifndef CCAPI_ORDER_QUANTITY_MAX
#define CCAPI_ORDER_QUANTITY_MAX "QUANTITY_MAX"
#endif
#ifndef CCAPI_ORDER_PRICE_TIMES_QUANTITY_MIN
#define CCAPI_ORDER_PRICE_TIMES_QUANTITY_MIN "PRICE_TIMES_QUANTITY_MIN"
#endif
Expand Down Expand Up @@ -538,6 +541,9 @@
#ifndef CCAPI_EM_POSITION_LEVERAGE
#define CCAPI_EM_POSITION_LEVERAGE "LEVERAGE"
#endif
#ifndef CCAPI_EM_UNREALIZED_PNL
#define CCAPI_EM_UNREALIZED_PNL "UNREALIZED_PNL"
#endif
#ifndef CCAPI_HTTP_STATUS_CODE
#define CCAPI_HTTP_STATUS_CODE "HTTP_STATUS_CODE"
#endif
Expand Down
Expand Up @@ -45,6 +45,7 @@ class ExecutionManagementServiceBinanceDerivativesBase : public ExecutionManagem
element.insert(CCAPI_EM_POSITION_QUANTITY, positionAmt);
element.insert(CCAPI_EM_POSITION_ENTRY_PRICE, x["entryPrice"].GetString());
element.insert(CCAPI_EM_POSITION_LEVERAGE, x["leverage"].GetString());
element.insert(CCAPI_EM_UNREALIZED_PNL, x["unrealizedProfit"].GetString());
elementList.emplace_back(std::move(element));
}
} break;
Expand Down
Expand Up @@ -45,6 +45,9 @@ class MarketDataServiceBinanceDerivativesBase : public MarketDataServiceBinanceB
}
}
void extractInstrumentInfo(Element& element, const rj::Value& x) {
element.insert(CCAPI_INSTRUMENT, x["symbol"].GetString());
element.insert(CCAPI_BASE_ASSET, x["baseAsset"].GetString());
element.insert(CCAPI_QUOTE_ASSET, x["quoteAsset"].GetString());
element.insert(CCAPI_INSTRUMENT, x["symbol"].GetString());
element.insert(CCAPI_MARGIN_ASSET, x["marginAsset"].GetString());
element.insert(CCAPI_UNDERLYING_SYMBOL, x["pair"].GetString());
Expand All @@ -55,6 +58,7 @@ class MarketDataServiceBinanceDerivativesBase : public MarketDataServiceBinanceB
} else if (filterType == "LOT_SIZE") {
element.insert(CCAPI_ORDER_QUANTITY_INCREMENT, y["stepSize"].GetString());
element.insert(CCAPI_ORDER_QUANTITY_MIN, y["minQty"].GetString());
element.insert(CCAPI_ORDER_QUANTITY_MAX, y["maxQty"].GetString());
} else if (filterType == "MIN_NOTIONAL") {
element.insert(CCAPI_ORDER_PRICE_TIMES_QUANTITY_MIN, y["notional"].GetString());
}
Expand Down

0 comments on commit 96ac149

Please sign in to comment.