CPPKiteConnect
user.hpp
1 /*
2  * Licensed under the MIT License <http://opensource.org/licenses/MIT>.
3  * SPDX-License-Identifier: MIT
4  *
5  * Copyright (c) 2020-2022 Bhumit Attarde
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a
8  * copy of this software and associated documentation files (the "Software"),
9  * to deal in the Software without restriction, including without limitation
10  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11  * and/or sell copies of the Software, and to permit persons to whom the
12  * Software is furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in
15  * all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
20  * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
22  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23  * USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
26 #pragma once
27 #pragma clang diagnostic ignored "-Wundefined-inline"
28 
29 #include "../kite.hpp"
30 #include "../utils.hpp"
31 
32 namespace kiteconnect {
34  return callApi<userProfile, utils::json::JsonObject>("user.profile");
35 };
36 
38  return callApi<allMargins, utils::json::JsonObject>("user.margins");
39 };
40 
41 inline margins kite::getMargins(const string& segment) {
42  return callApi<margins, utils::json::JsonObject>(
43  "user.margins.segment", {}, { segment });
44 };
45 } // namespace kiteconnect
kiteconnect::allMargins
Represents all margins (equity and commodity).
Definition: user.hpp:186
kiteconnect::margins
Represents user margins for a segment.
Definition: user.hpp:166
kiteconnect::userProfile
Represents an user's profile.
Definition: user.hpp:42
kiteconnect::kite::getMargins
allMargins getMargins()
Get margins for all segments.
Definition: user.hpp:37
kiteconnect::kite::profile
userProfile profile()
Get user's profile.
Definition: user.hpp:33