|
12 | 12 | CANCEL_ORDER, MODIFY_ORDER, PLACE_ORDER, ACTIVE_ORDERS, INACTIVE_ORDERS, FILLED_ORDERS, CONTRACT, PREVIEW_ORDER, \ |
13 | 13 | PRIME_ASSETS, ORDER_TRANSACTIONS, QUOTE_CONTRACT, ANALYTICS_ASSET, SEGMENT_FUND_AVAILABLE, SEGMENT_FUND_HISTORY, \ |
14 | 14 | TRANSFER_FUND, \ |
15 | | - TRANSFER_SEGMENT_FUND, CANCEL_SEGMENT_FUND, PLACE_FOREX_ORDER, ESTIMATE_TRADABLE_QUANTITY, AGGREGATE_ASSETS |
| 15 | + TRANSFER_SEGMENT_FUND, CANCEL_SEGMENT_FUND, PLACE_FOREX_ORDER, ESTIMATE_TRADABLE_QUANTITY, AGGREGATE_ASSETS, \ |
| 16 | + FUND_DETAILS |
16 | 17 | from tigeropen.common.exceptions import ApiException |
17 | 18 | from tigeropen.common.util.common_utils import get_enum_value, date_str_to_timestamp |
18 | 19 | from tigeropen.common.request import OpenApiRequest |
|
21 | 22 | from tigeropen.trade.domain.order import Order |
22 | 23 | from tigeropen.trade.request.model import ContractParams, AccountsParams, AssetParams, PositionParams, OrdersParams, \ |
23 | 24 | OrderParams, PlaceModifyOrderParams, CancelOrderParams, TransactionsParams, AnalyticsAssetParams, SegmentFundParams, \ |
24 | | - ForexTradeOrderParams, EstimateTradableQuantityModel, FundingHistoryParams, AggregateAssetParams |
| 25 | + ForexTradeOrderParams, EstimateTradableQuantityModel, FundingHistoryParams, AggregateAssetParams, FundDetailsParams |
25 | 26 | from tigeropen.trade.response.account_profile_response import ProfilesResponse |
26 | 27 | from tigeropen.trade.response.aggregate_assets_response import AggregateAssetsResponse |
27 | 28 | from tigeropen.trade.response.analytics_asset_response import AnalyticsAssetResponse |
28 | 29 | from tigeropen.trade.response.assets_response import AssetsResponse |
29 | 30 | from tigeropen.trade.response.contracts_response import ContractsResponse |
30 | 31 | from tigeropen.trade.response.forex_order_response import ForexOrderResponse |
| 32 | +from tigeropen.trade.response.fund_details_response import FundDetailsResponse |
31 | 33 | from tigeropen.trade.response.order_id_response import OrderIdResponse |
32 | 34 | from tigeropen.trade.response.order_preview_response import PreviewOrderResponse |
33 | 35 | from tigeropen.trade.response.orders_response import OrdersResponse |
@@ -935,11 +937,40 @@ def get_funding_history(self, seg_type=None): |
935 | 937 | response = FundingHistoryResponse() |
936 | 938 | response.parse_response_content(response_content) |
937 | 939 | if response.is_success(): |
938 | | - return response.data |
| 940 | + return response.result |
939 | 941 | else: |
940 | 942 | raise ApiException(response.code, response.message) |
941 | 943 | return None |
942 | 944 |
|
| 945 | + def get_fund_details(self, seg_types, account=None, fund_type=None, currency=None, |
| 946 | + start=0, limit=None, start_date=None, end_date=None, secret_key=None, |
| 947 | + lang=None): |
| 948 | + params = FundDetailsParams() |
| 949 | + params.account = account if account else self._account |
| 950 | + params.secret_key = secret_key if secret_key else self._secret_key |
| 951 | + if seg_types: |
| 952 | + seg_types_list = seg_types if isinstance(seg_types, list) else [seg_types] |
| 953 | + seg_types_params = [get_enum_value(t) for t in seg_types_list] |
| 954 | + params.seg_types = seg_types_params |
| 955 | + params.fund_type = get_enum_value(fund_type) |
| 956 | + params.currency = get_enum_value(currency) |
| 957 | + params.start = start |
| 958 | + params.limit = limit |
| 959 | + params.start_date = start_date |
| 960 | + params.end_date = end_date |
| 961 | + params.lang = get_enum_value(lang) if lang else get_enum_value(self._lang) |
| 962 | + |
| 963 | + request = OpenApiRequest(FUND_DETAILS, biz_model=params) |
| 964 | + response_content = self.__fetch_data(request) |
| 965 | + if response_content: |
| 966 | + response = FundDetailsResponse() |
| 967 | + response.parse_response_content(response_content) |
| 968 | + if response.is_success(): |
| 969 | + return response.result |
| 970 | + else: |
| 971 | + raise ApiException(response.code, response.message) |
| 972 | + |
| 973 | + |
943 | 974 | def __fetch_data(self, request): |
944 | 975 | try: |
945 | 976 | response = super(TradeClient, self).execute(request) |
|
0 commit comments