27 #pragma clang diagnostic ignored "-Wundefined-inline"
31 #include "../kite.hpp"
32 #include "../utils.hpp"
34 namespace kiteconnect {
36 const std::vector<marginsParams>& params) {
37 utils::json::json<utils::json::JsonArray> ordersJson;
40 ordersJson.field(
"exchange", param.exchange, &buffer);
41 ordersJson.field(
"tradingsymbol", param.tradingsymbol, &buffer);
42 ordersJson.field(
"transaction_type", param.transactionType, &buffer);
43 ordersJson.field(
"variety", param.variety, &buffer);
44 ordersJson.field(
"product", param.product, &buffer);
45 ordersJson.field(
"order_type", param.orderType, &buffer);
46 ordersJson.field(
"quantity", param.quantity, &buffer);
47 ordersJson.field(
"price", param.price, &buffer);
48 ordersJson.field(
"trigger_price", param.triggerPrice, &buffer);
51 return callApi<std::vector<orderMargins>, utils::json::JsonArray,
true>(
52 "margins.orders", { {
"", ordersJson.serialize() } }, {},
53 [](utils::json::JsonArray& data) {
54 std::vector<orderMargins>
margins;
55 for (
auto& i : data) {
margins.emplace_back(i.GetObject()); }
61 const std::vector<marginsParams>& params,
bool considerPositions) {
62 utils::json::json<utils::json::JsonArray> ordersJson;
65 ordersJson.field(
"exchange", param.exchange, &buffer);
66 ordersJson.field(
"tradingsymbol", param.tradingsymbol, &buffer);
67 ordersJson.field(
"transaction_type", param.transactionType, &buffer);
68 ordersJson.field(
"variety", param.variety, &buffer);
69 ordersJson.field(
"product", param.product, &buffer);
70 ordersJson.field(
"order_type", param.orderType, &buffer);
71 ordersJson.field(
"quantity", param.quantity, &buffer);
72 ordersJson.field(
"price", param.price, &buffer);
73 ordersJson.field(
"trigger_price", param.triggerPrice, &buffer);
76 return callApi<basketMargins, utils::json::JsonObject>(
"margins.basket",
77 { {
"", ordersJson.serialize() } },
78 { considerPositions ?
"true" :
"false" });