binance-sdk-derivatives-trading-portfolio-margin 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of binance-sdk-derivatives-trading-portfolio-margin might be problematic. Click here for more details.

Files changed (204) hide show
  1. CHANGELOG.md +5 -0
  2. README.md +293 -0
  3. binance_sdk_derivatives_trading_portfolio_margin/__init__.py +39 -0
  4. binance_sdk_derivatives_trading_portfolio_margin/derivatives_trading_portfolio_margin.py +68 -0
  5. binance_sdk_derivatives_trading_portfolio_margin/metadata.py +1 -0
  6. binance_sdk_derivatives_trading_portfolio_margin/rest_api/__init__.py +13 -0
  7. binance_sdk_derivatives_trading_portfolio_margin/rest_api/api/__init__.py +14 -0
  8. binance_sdk_derivatives_trading_portfolio_margin/rest_api/api/account_api.py +2096 -0
  9. binance_sdk_derivatives_trading_portfolio_margin/rest_api/api/market_data_api.py +62 -0
  10. binance_sdk_derivatives_trading_portfolio_margin/rest_api/api/trade_api.py +3557 -0
  11. binance_sdk_derivatives_trading_portfolio_margin/rest_api/api/user_data_streams_api.py +132 -0
  12. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/__init__.py +550 -0
  13. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/account_balance_response.py +145 -0
  14. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/account_balance_response1.py +81 -0
  15. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/account_balance_response1_inner.py +164 -0
  16. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/account_balance_response2.py +159 -0
  17. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/account_information_response.py +145 -0
  18. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/bnb_transfer_response.py +102 -0
  19. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_all_cm_open_conditional_orders_response.py +103 -0
  20. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_all_cm_open_orders_response.py +103 -0
  21. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_all_um_open_conditional_orders_response.py +103 -0
  22. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_all_um_open_orders_response.py +103 -0
  23. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_cm_conditional_order_response.py +161 -0
  24. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_cm_order_response.py +156 -0
  25. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_margin_account_all_open_orders_on_a_symbol_response.py +83 -0
  26. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_margin_account_all_open_orders_on_a_symbol_response_inner.py +215 -0
  27. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_margin_account_all_open_orders_on_a_symbol_response_inner_order_reports_inner.py +156 -0
  28. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_margin_account_all_open_orders_on_a_symbol_response_inner_orders_inner.py +110 -0
  29. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_margin_account_oco_orders_response.py +174 -0
  30. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_margin_account_oco_orders_response_order_reports_inner.py +151 -0
  31. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_margin_account_oco_orders_response_orders_inner.py +110 -0
  32. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_margin_account_order_response.py +145 -0
  33. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_um_conditional_order_response.py +172 -0
  34. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cancel_um_order_response.py +164 -0
  35. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/change_auto_repay_futures_status_response.py +102 -0
  36. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/change_cm_initial_leverage_response.py +110 -0
  37. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/change_cm_position_mode_response.py +103 -0
  38. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/change_um_initial_leverage_response.py +112 -0
  39. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/change_um_position_mode_response.py +103 -0
  40. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cm_account_trade_list_response.py +81 -0
  41. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cm_account_trade_list_response_inner.py +153 -0
  42. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cm_notional_and_leverage_brackets_response.py +81 -0
  43. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cm_notional_and_leverage_brackets_response_inner.py +129 -0
  44. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cm_notional_and_leverage_brackets_response_inner_brackets_inner.py +125 -0
  45. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cm_position_adl_quantile_estimation_response.py +83 -0
  46. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cm_position_adl_quantile_estimation_response_inner.py +122 -0
  47. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/cm_position_adl_quantile_estimation_response_inner_adl_quantile.py +112 -0
  48. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/enums.py +278 -0
  49. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/fund_auto_collection_response.py +102 -0
  50. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/fund_collection_by_asset_response.py +102 -0
  51. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_auto_repay_futures_status_response.py +102 -0
  52. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_cm_account_detail_response.py +142 -0
  53. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_cm_account_detail_response_assets_inner.py +135 -0
  54. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_cm_account_detail_response_positions_inner.py +147 -0
  55. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_cm_current_position_mode_response.py +104 -0
  56. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_cm_income_history_response.py +81 -0
  57. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_cm_income_history_response_inner.py +129 -0
  58. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_download_id_for_um_futures_order_history_response.py +110 -0
  59. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_download_id_for_um_futures_trade_history_response.py +110 -0
  60. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_download_id_for_um_futures_transaction_history_response.py +110 -0
  61. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_margin_borrow_loan_interest_history_response.py +127 -0
  62. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_margin_borrow_loan_interest_history_response_rows_inner.py +131 -0
  63. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_account_detail_response.py +142 -0
  64. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_account_detail_response_positions_inner.py +153 -0
  65. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_account_detail_v2_response.py +142 -0
  66. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_account_detail_v2_response_assets_inner.py +135 -0
  67. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_account_detail_v2_response_positions_inner.py +131 -0
  68. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_current_position_mode_response.py +104 -0
  69. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_futures_bnb_burn_status_response.py +102 -0
  70. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_futures_order_download_link_by_id_response.py +128 -0
  71. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_futures_trade_download_link_by_id_response.py +128 -0
  72. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_futures_transaction_download_link_by_id_response.py +128 -0
  73. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_income_history_response.py +81 -0
  74. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_um_income_history_response_inner.py +129 -0
  75. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_user_commission_rate_for_cm_response.py +118 -0
  76. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/get_user_commission_rate_for_um_response.py +118 -0
  77. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/margin_account_borrow_response.py +102 -0
  78. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/margin_account_new_oco_response.py +182 -0
  79. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/margin_account_new_oco_response_order_reports_inner.py +149 -0
  80. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/margin_account_new_oco_response_orders_inner.py +110 -0
  81. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/margin_account_repay_debt_response.py +122 -0
  82. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/margin_account_repay_response.py +102 -0
  83. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/margin_account_trade_list_response.py +81 -0
  84. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/margin_account_trade_list_response_inner.py +138 -0
  85. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/margin_max_borrow_response.py +105 -0
  86. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/modify_cm_order_response.py +159 -0
  87. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/modify_um_order_response.py +167 -0
  88. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/new_cm_conditional_order_response.py +164 -0
  89. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/new_cm_order_response.py +156 -0
  90. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/new_margin_order_response.py +173 -0
  91. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/new_margin_order_response_fills_inner.py +117 -0
  92. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/new_um_conditional_order_response.py +172 -0
  93. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/new_um_order_response.py +164 -0
  94. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/portfolio_margin_um_trading_quantitative_rules_indicators_response.py +122 -0
  95. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/portfolio_margin_um_trading_quantitative_rules_indicators_response_indicators.py +154 -0
  96. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/portfolio_margin_um_trading_quantitative_rules_indicators_response_indicators_account_inner.py +124 -0
  97. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/portfolio_margin_um_trading_quantitative_rules_indicators_response_indicators_btcusdt_inner.py +134 -0
  98. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_cm_conditional_orders_response.py +81 -0
  99. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_cm_conditional_orders_response_inner.py +167 -0
  100. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_cm_orders_response.py +81 -0
  101. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_cm_orders_response_inner.py +159 -0
  102. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_current_cm_open_conditional_orders_response.py +83 -0
  103. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_current_cm_open_conditional_orders_response_inner.py +155 -0
  104. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_current_cm_open_orders_response.py +81 -0
  105. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_current_um_open_conditional_orders_response.py +83 -0
  106. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_current_um_open_conditional_orders_response_inner.py +166 -0
  107. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_current_um_open_orders_response.py +81 -0
  108. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_current_um_open_orders_response_inner.py +167 -0
  109. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_margin_account_orders_response.py +81 -0
  110. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_margin_account_orders_response_inner.py +173 -0
  111. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_um_conditional_orders_response.py +81 -0
  112. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_um_conditional_orders_response_inner.py +178 -0
  113. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_all_um_orders_response.py +81 -0
  114. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_cm_conditional_order_history_response.py +176 -0
  115. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_cm_modify_order_history_response.py +81 -0
  116. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_cm_modify_order_history_response_inner.py +138 -0
  117. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_cm_modify_order_history_response_inner_amendment.py +136 -0
  118. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_cm_modify_order_history_response_inner_amendment_orig_qty.py +105 -0
  119. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_cm_modify_order_history_response_inner_amendment_price.py +105 -0
  120. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_cm_order_response.py +159 -0
  121. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_cm_position_information_response.py +81 -0
  122. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_cm_position_information_response_inner.py +142 -0
  123. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_current_cm_open_conditional_order_response.py +155 -0
  124. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_current_cm_open_order_response.py +159 -0
  125. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_current_margin_open_order_response.py +81 -0
  126. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_current_margin_open_order_response_inner.py +173 -0
  127. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_current_um_open_conditional_order_response.py +166 -0
  128. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_current_um_open_order_response.py +167 -0
  129. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_account_order_response.py +173 -0
  130. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_accounts_all_oco_response.py +81 -0
  131. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_accounts_all_oco_response_inner.py +152 -0
  132. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_accounts_all_oco_response_inner_orders_inner.py +110 -0
  133. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_accounts_oco_response.py +150 -0
  134. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_accounts_oco_response_orders_inner.py +110 -0
  135. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_accounts_open_oco_response.py +81 -0
  136. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_accounts_open_oco_response_inner.py +152 -0
  137. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_accounts_open_oco_response_inner_orders_inner.py +110 -0
  138. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_loan_record_response.py +125 -0
  139. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_loan_record_response_rows_inner.py +120 -0
  140. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_max_withdraw_response.py +102 -0
  141. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_repay_record_response.py +125 -0
  142. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_margin_repay_record_response_rows_inner.py +126 -0
  143. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_portfolio_margin_negative_balance_interest_history_response.py +83 -0
  144. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_portfolio_margin_negative_balance_interest_history_response_inner.py +122 -0
  145. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_um_conditional_order_history_response.py +181 -0
  146. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_um_modify_order_history_response.py +81 -0
  147. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_um_modify_order_history_response_inner.py +141 -0
  148. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_um_order_response.py +167 -0
  149. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_um_position_information_response.py +81 -0
  150. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_um_position_information_response_inner.py +144 -0
  151. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_user_negative_balance_auto_exchange_record_response.py +129 -0
  152. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_user_negative_balance_auto_exchange_record_response_rows_inner.py +131 -0
  153. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_user_negative_balance_auto_exchange_record_response_rows_inner_details_inner.py +120 -0
  154. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_user_rate_limit_response.py +81 -0
  155. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_user_rate_limit_response_inner.py +117 -0
  156. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_users_cm_force_orders_response.py +81 -0
  157. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_users_cm_force_orders_response_inner.py +159 -0
  158. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_users_margin_force_orders_response.py +125 -0
  159. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_users_margin_force_orders_response_rows_inner.py +132 -0
  160. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_users_um_force_orders_response.py +81 -0
  161. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/query_users_um_force_orders_response_inner.py +156 -0
  162. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/repay_futures_negative_balance_response.py +102 -0
  163. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/start_user_data_stream_response.py +102 -0
  164. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/toggle_bnb_burn_on_um_futures_trade_response.py +103 -0
  165. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/um_account_trade_list_response.py +81 -0
  166. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/um_account_trade_list_response_inner.py +147 -0
  167. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/um_futures_account_configuration_response.py +133 -0
  168. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/um_futures_symbol_configuration_response.py +81 -0
  169. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/um_futures_symbol_configuration_response_inner.py +124 -0
  170. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/um_notional_and_leverage_brackets_response.py +81 -0
  171. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/um_notional_and_leverage_brackets_response_inner.py +131 -0
  172. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/um_notional_and_leverage_brackets_response_inner_brackets_inner.py +125 -0
  173. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/um_position_adl_quantile_estimation_response.py +83 -0
  174. binance_sdk_derivatives_trading_portfolio_margin/rest_api/models/um_position_adl_quantile_estimation_response_inner.py +122 -0
  175. binance_sdk_derivatives_trading_portfolio_margin/rest_api/rest_api.py +3837 -0
  176. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/__init__.py +13 -0
  177. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/__init__.py +38 -0
  178. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/account_config_update.py +118 -0
  179. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/account_config_update_ac.py +99 -0
  180. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/account_update.py +120 -0
  181. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/account_update_a.py +134 -0
  182. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/account_update_ab_inner.py +108 -0
  183. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/account_update_ap_inner.py +114 -0
  184. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/balanceupdate.py +110 -0
  185. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/conditional_order_trade_update.py +118 -0
  186. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/conditional_order_trade_update_so.py +164 -0
  187. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/enums.py +9 -0
  188. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/executionreport.py +227 -0
  189. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/liabilitychange.py +114 -0
  190. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/listenkeyexpired.py +98 -0
  191. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/openorderloss.py +118 -0
  192. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/openorderloss_o_inner.py +99 -0
  193. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/order_trade_update.py +120 -0
  194. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/order_trade_update_o.py +188 -0
  195. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/outboundaccountposition.py +125 -0
  196. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/outboundaccountposition_b_inner.py +102 -0
  197. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/risklevelchange.py +112 -0
  198. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/models/user_data_stream_events_response.py +386 -0
  199. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/streams/__init__.py +9 -0
  200. binance_sdk_derivatives_trading_portfolio_margin/websocket_streams/websocket_streams.py +105 -0
  201. binance_sdk_derivatives_trading_portfolio_margin-1.0.0.dist-info/LICENCE +21 -0
  202. binance_sdk_derivatives_trading_portfolio_margin-1.0.0.dist-info/METADATA +321 -0
  203. binance_sdk_derivatives_trading_portfolio_margin-1.0.0.dist-info/RECORD +204 -0
  204. binance_sdk_derivatives_trading_portfolio_margin-1.0.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,3557 @@
1
+ """
2
+ Binance Derivatives Trading Portfolio Margin REST API
3
+
4
+ OpenAPI Specification for the Binance Derivatives Trading Portfolio Margin REST API
5
+ The version of the OpenAPI document: 1.0.0
6
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
7
+
8
+ Do not edit the class manually.
9
+ """
10
+
11
+ from typing import Optional
12
+ from requests import Session
13
+ from binance_common.configuration import ConfigurationRestAPI
14
+ from binance_common.errors import RequiredError
15
+ from binance_common.models import ApiResponse
16
+ from binance_common.signature import Signers
17
+ from binance_common.utils import send_request
18
+
19
+ from ..models import CancelAllCmOpenConditionalOrdersResponse
20
+ from ..models import CancelAllCmOpenOrdersResponse
21
+ from ..models import CancelAllUmOpenConditionalOrdersResponse
22
+ from ..models import CancelAllUmOpenOrdersResponse
23
+ from ..models import CancelCmConditionalOrderResponse
24
+ from ..models import CancelCmOrderResponse
25
+ from ..models import CancelMarginAccountAllOpenOrdersOnASymbolResponse
26
+ from ..models import CancelMarginAccountOcoOrdersResponse
27
+ from ..models import CancelMarginAccountOrderResponse
28
+ from ..models import CancelUmConditionalOrderResponse
29
+ from ..models import CancelUmOrderResponse
30
+ from ..models import CmAccountTradeListResponse
31
+ from ..models import CmPositionAdlQuantileEstimationResponse
32
+ from ..models import GetUmFuturesBnbBurnStatusResponse
33
+ from ..models import MarginAccountBorrowResponse
34
+ from ..models import MarginAccountNewOcoResponse
35
+ from ..models import MarginAccountRepayResponse
36
+ from ..models import MarginAccountRepayDebtResponse
37
+ from ..models import MarginAccountTradeListResponse
38
+ from ..models import ModifyCmOrderResponse
39
+ from ..models import ModifyUmOrderResponse
40
+ from ..models import NewCmConditionalOrderResponse
41
+ from ..models import NewCmOrderResponse
42
+ from ..models import NewMarginOrderResponse
43
+ from ..models import NewUmConditionalOrderResponse
44
+ from ..models import NewUmOrderResponse
45
+ from ..models import QueryAllCmConditionalOrdersResponse
46
+ from ..models import QueryAllCmOrdersResponse
47
+ from ..models import QueryAllCurrentCmOpenConditionalOrdersResponse
48
+ from ..models import QueryAllCurrentCmOpenOrdersResponse
49
+ from ..models import QueryAllCurrentUmOpenConditionalOrdersResponse
50
+ from ..models import QueryAllCurrentUmOpenOrdersResponse
51
+ from ..models import QueryAllMarginAccountOrdersResponse
52
+ from ..models import QueryAllUmConditionalOrdersResponse
53
+ from ..models import QueryAllUmOrdersResponse
54
+ from ..models import QueryCmConditionalOrderHistoryResponse
55
+ from ..models import QueryCmModifyOrderHistoryResponse
56
+ from ..models import QueryCmOrderResponse
57
+ from ..models import QueryCurrentCmOpenConditionalOrderResponse
58
+ from ..models import QueryCurrentCmOpenOrderResponse
59
+ from ..models import QueryCurrentMarginOpenOrderResponse
60
+ from ..models import QueryCurrentUmOpenConditionalOrderResponse
61
+ from ..models import QueryCurrentUmOpenOrderResponse
62
+ from ..models import QueryMarginAccountOrderResponse
63
+ from ..models import QueryMarginAccountsAllOcoResponse
64
+ from ..models import QueryMarginAccountsOcoResponse
65
+ from ..models import QueryMarginAccountsOpenOcoResponse
66
+ from ..models import QueryUmConditionalOrderHistoryResponse
67
+ from ..models import QueryUmModifyOrderHistoryResponse
68
+ from ..models import QueryUmOrderResponse
69
+ from ..models import QueryUsersCmForceOrdersResponse
70
+ from ..models import QueryUsersMarginForceOrdersResponse
71
+ from ..models import QueryUsersUmForceOrdersResponse
72
+ from ..models import ToggleBnbBurnOnUmFuturesTradeResponse
73
+ from ..models import UmAccountTradeListResponse
74
+ from ..models import UmPositionAdlQuantileEstimationResponse
75
+
76
+
77
+ from ..models import MarginAccountNewOcoSideEnum
78
+ from ..models import MarginAccountNewOcoStopLimitTimeInForceEnum
79
+ from ..models import MarginAccountNewOcoNewOrderRespTypeEnum
80
+ from ..models import MarginAccountNewOcoSideEffectTypeEnum
81
+ from ..models import ModifyCmOrderSideEnum
82
+ from ..models import ModifyCmOrderPriceMatchEnum
83
+ from ..models import ModifyUmOrderSideEnum
84
+ from ..models import ModifyUmOrderPriceMatchEnum
85
+ from ..models import NewCmConditionalOrderSideEnum
86
+ from ..models import NewCmConditionalOrderStrategyTypeEnum
87
+ from ..models import NewCmConditionalOrderPositionSideEnum
88
+ from ..models import NewCmConditionalOrderTimeInForceEnum
89
+ from ..models import NewCmConditionalOrderWorkingTypeEnum
90
+ from ..models import NewCmOrderSideEnum
91
+ from ..models import NewCmOrderTypeEnum
92
+ from ..models import NewCmOrderPositionSideEnum
93
+ from ..models import NewCmOrderTimeInForceEnum
94
+ from ..models import NewCmOrderPriceMatchEnum
95
+ from ..models import NewCmOrderNewOrderRespTypeEnum
96
+ from ..models import NewMarginOrderSideEnum
97
+ from ..models import NewMarginOrderTypeEnum
98
+ from ..models import NewMarginOrderNewOrderRespTypeEnum
99
+ from ..models import NewMarginOrderSideEffectTypeEnum
100
+ from ..models import NewMarginOrderTimeInForceEnum
101
+ from ..models import NewMarginOrderSelfTradePreventionModeEnum
102
+ from ..models import NewUmConditionalOrderSideEnum
103
+ from ..models import NewUmConditionalOrderStrategyTypeEnum
104
+ from ..models import NewUmConditionalOrderPositionSideEnum
105
+ from ..models import NewUmConditionalOrderTimeInForceEnum
106
+ from ..models import NewUmConditionalOrderWorkingTypeEnum
107
+ from ..models import NewUmConditionalOrderPriceMatchEnum
108
+ from ..models import NewUmConditionalOrderSelfTradePreventionModeEnum
109
+ from ..models import NewUmOrderSideEnum
110
+ from ..models import NewUmOrderTypeEnum
111
+ from ..models import NewUmOrderPositionSideEnum
112
+ from ..models import NewUmOrderTimeInForceEnum
113
+ from ..models import NewUmOrderNewOrderRespTypeEnum
114
+ from ..models import NewUmOrderPriceMatchEnum
115
+ from ..models import NewUmOrderSelfTradePreventionModeEnum
116
+ from ..models import QueryUsersCmForceOrdersAutoCloseTypeEnum
117
+ from ..models import QueryUsersUmForceOrdersAutoCloseTypeEnum
118
+
119
+
120
+ class TradeApi:
121
+ """API Client for TradeApi endpoints."""
122
+
123
+ def __init__(
124
+ self,
125
+ configuration: ConfigurationRestAPI = None,
126
+ session: Session = None,
127
+ signer: Signers = None,
128
+ ) -> None:
129
+ self._configuration = configuration
130
+ self._session = session
131
+ self._signer = signer
132
+
133
+ def cancel_all_cm_open_conditional_orders(
134
+ self,
135
+ symbol: str = None,
136
+ recv_window: Optional[int] = None,
137
+ ) -> ApiResponse[CancelAllCmOpenConditionalOrdersResponse]:
138
+ """
139
+ Cancel All CM Open Conditional Orders(TRADE)
140
+ DELETE /papi/v1/cm/conditional/allOpenOrders
141
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Conditional-Orders
142
+
143
+ Cancel All CM Open Conditional Orders
144
+
145
+ Weight: 1
146
+
147
+ Args:
148
+ symbol (str):
149
+ recv_window (Optional[int]):
150
+
151
+ Returns:
152
+ ApiResponse[CancelAllCmOpenConditionalOrdersResponse]
153
+
154
+ Raises:
155
+ RequiredError: If a required parameter is missing.
156
+
157
+ """
158
+
159
+ if symbol is None:
160
+ raise RequiredError(
161
+ field="symbol", error_message="Missing required parameter 'symbol'"
162
+ )
163
+
164
+ payload = {"symbol": symbol, "recv_window": recv_window}
165
+
166
+ return send_request(
167
+ self._session,
168
+ self._configuration,
169
+ method="DELETE",
170
+ path="/papi/v1/cm/conditional/allOpenOrders",
171
+ payload=payload,
172
+ time_unit=self._configuration.time_unit,
173
+ response_model=CancelAllCmOpenConditionalOrdersResponse,
174
+ is_signed=True,
175
+ signer=self._signer,
176
+ )
177
+
178
+ def cancel_all_cm_open_orders(
179
+ self,
180
+ symbol: str = None,
181
+ recv_window: Optional[int] = None,
182
+ ) -> ApiResponse[CancelAllCmOpenOrdersResponse]:
183
+ """
184
+ Cancel All CM Open Orders(TRADE)
185
+ DELETE /papi/v1/cm/allOpenOrders
186
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Orders
187
+
188
+ Cancel all active LIMIT orders on specific symbol
189
+
190
+ Weight: 1
191
+
192
+ Args:
193
+ symbol (str):
194
+ recv_window (Optional[int]):
195
+
196
+ Returns:
197
+ ApiResponse[CancelAllCmOpenOrdersResponse]
198
+
199
+ Raises:
200
+ RequiredError: If a required parameter is missing.
201
+
202
+ """
203
+
204
+ if symbol is None:
205
+ raise RequiredError(
206
+ field="symbol", error_message="Missing required parameter 'symbol'"
207
+ )
208
+
209
+ payload = {"symbol": symbol, "recv_window": recv_window}
210
+
211
+ return send_request(
212
+ self._session,
213
+ self._configuration,
214
+ method="DELETE",
215
+ path="/papi/v1/cm/allOpenOrders",
216
+ payload=payload,
217
+ time_unit=self._configuration.time_unit,
218
+ response_model=CancelAllCmOpenOrdersResponse,
219
+ is_signed=True,
220
+ signer=self._signer,
221
+ )
222
+
223
+ def cancel_all_um_open_conditional_orders(
224
+ self,
225
+ symbol: str = None,
226
+ recv_window: Optional[int] = None,
227
+ ) -> ApiResponse[CancelAllUmOpenConditionalOrdersResponse]:
228
+ """
229
+ Cancel All UM Open Conditional Orders (TRADE)
230
+ DELETE /papi/v1/um/conditional/allOpenOrders
231
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-UM-Open-Conditional-Orders
232
+
233
+ Cancel All UM Open Conditional Orders
234
+
235
+ Weight: 1
236
+
237
+ Args:
238
+ symbol (str):
239
+ recv_window (Optional[int]):
240
+
241
+ Returns:
242
+ ApiResponse[CancelAllUmOpenConditionalOrdersResponse]
243
+
244
+ Raises:
245
+ RequiredError: If a required parameter is missing.
246
+
247
+ """
248
+
249
+ if symbol is None:
250
+ raise RequiredError(
251
+ field="symbol", error_message="Missing required parameter 'symbol'"
252
+ )
253
+
254
+ payload = {"symbol": symbol, "recv_window": recv_window}
255
+
256
+ return send_request(
257
+ self._session,
258
+ self._configuration,
259
+ method="DELETE",
260
+ path="/papi/v1/um/conditional/allOpenOrders",
261
+ payload=payload,
262
+ time_unit=self._configuration.time_unit,
263
+ response_model=CancelAllUmOpenConditionalOrdersResponse,
264
+ is_signed=True,
265
+ signer=self._signer,
266
+ )
267
+
268
+ def cancel_all_um_open_orders(
269
+ self,
270
+ symbol: str = None,
271
+ recv_window: Optional[int] = None,
272
+ ) -> ApiResponse[CancelAllUmOpenOrdersResponse]:
273
+ """
274
+ Cancel All UM Open Orders(TRADE)
275
+ DELETE /papi/v1/um/allOpenOrders
276
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-UM-Open-Orders
277
+
278
+ Cancel all active LIMIT orders on specific symbol
279
+
280
+ Weight: 1
281
+
282
+ Args:
283
+ symbol (str):
284
+ recv_window (Optional[int]):
285
+
286
+ Returns:
287
+ ApiResponse[CancelAllUmOpenOrdersResponse]
288
+
289
+ Raises:
290
+ RequiredError: If a required parameter is missing.
291
+
292
+ """
293
+
294
+ if symbol is None:
295
+ raise RequiredError(
296
+ field="symbol", error_message="Missing required parameter 'symbol'"
297
+ )
298
+
299
+ payload = {"symbol": symbol, "recv_window": recv_window}
300
+
301
+ return send_request(
302
+ self._session,
303
+ self._configuration,
304
+ method="DELETE",
305
+ path="/papi/v1/um/allOpenOrders",
306
+ payload=payload,
307
+ time_unit=self._configuration.time_unit,
308
+ response_model=CancelAllUmOpenOrdersResponse,
309
+ is_signed=True,
310
+ signer=self._signer,
311
+ )
312
+
313
+ def cancel_cm_conditional_order(
314
+ self,
315
+ symbol: str = None,
316
+ strategy_id: Optional[int] = None,
317
+ new_client_strategy_id: Optional[str] = None,
318
+ recv_window: Optional[int] = None,
319
+ ) -> ApiResponse[CancelCmConditionalOrderResponse]:
320
+ """
321
+ Cancel CM Conditional Order(TRADE)
322
+ DELETE /papi/v1/cm/conditional/order
323
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-CM-Conditional-Order
324
+
325
+ Cancel CM Conditional Order
326
+
327
+ * Either `strategyId` or `newClientStrategyId` must be sent.
328
+
329
+ Weight: 1
330
+
331
+ Args:
332
+ symbol (str):
333
+ strategy_id (Optional[int]):
334
+ new_client_strategy_id (Optional[str]):
335
+ recv_window (Optional[int]):
336
+
337
+ Returns:
338
+ ApiResponse[CancelCmConditionalOrderResponse]
339
+
340
+ Raises:
341
+ RequiredError: If a required parameter is missing.
342
+
343
+ """
344
+
345
+ if symbol is None:
346
+ raise RequiredError(
347
+ field="symbol", error_message="Missing required parameter 'symbol'"
348
+ )
349
+
350
+ payload = {
351
+ "symbol": symbol,
352
+ "strategy_id": strategy_id,
353
+ "new_client_strategy_id": new_client_strategy_id,
354
+ "recv_window": recv_window,
355
+ }
356
+
357
+ return send_request(
358
+ self._session,
359
+ self._configuration,
360
+ method="DELETE",
361
+ path="/papi/v1/cm/conditional/order",
362
+ payload=payload,
363
+ time_unit=self._configuration.time_unit,
364
+ response_model=CancelCmConditionalOrderResponse,
365
+ is_signed=True,
366
+ signer=self._signer,
367
+ )
368
+
369
+ def cancel_cm_order(
370
+ self,
371
+ symbol: str = None,
372
+ order_id: Optional[int] = None,
373
+ orig_client_order_id: Optional[str] = None,
374
+ recv_window: Optional[int] = None,
375
+ ) -> ApiResponse[CancelCmOrderResponse]:
376
+ """
377
+ Cancel CM Order(TRADE)
378
+ DELETE /papi/v1/cm/order
379
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-CM-Order
380
+
381
+ Cancel an active LIMIT order
382
+
383
+ * Either `orderId` or `origClientOrderId` must be sent.
384
+
385
+ Weight: 1
386
+
387
+ Args:
388
+ symbol (str):
389
+ order_id (Optional[int]):
390
+ orig_client_order_id (Optional[str]):
391
+ recv_window (Optional[int]):
392
+
393
+ Returns:
394
+ ApiResponse[CancelCmOrderResponse]
395
+
396
+ Raises:
397
+ RequiredError: If a required parameter is missing.
398
+
399
+ """
400
+
401
+ if symbol is None:
402
+ raise RequiredError(
403
+ field="symbol", error_message="Missing required parameter 'symbol'"
404
+ )
405
+
406
+ payload = {
407
+ "symbol": symbol,
408
+ "order_id": order_id,
409
+ "orig_client_order_id": orig_client_order_id,
410
+ "recv_window": recv_window,
411
+ }
412
+
413
+ return send_request(
414
+ self._session,
415
+ self._configuration,
416
+ method="DELETE",
417
+ path="/papi/v1/cm/order",
418
+ payload=payload,
419
+ time_unit=self._configuration.time_unit,
420
+ response_model=CancelCmOrderResponse,
421
+ is_signed=True,
422
+ signer=self._signer,
423
+ )
424
+
425
+ def cancel_margin_account_all_open_orders_on_a_symbol(
426
+ self,
427
+ symbol: str = None,
428
+ recv_window: Optional[int] = None,
429
+ ) -> ApiResponse[CancelMarginAccountAllOpenOrdersOnASymbolResponse]:
430
+ """
431
+ Cancel Margin Account All Open Orders on a Symbol(TRADE)
432
+ DELETE /papi/v1/margin/allOpenOrders
433
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-Margin-Account-All-Open-Orders-on-a-Symbol
434
+
435
+ Cancel Margin Account All Open Orders on a Symbol
436
+
437
+ Weight: 5
438
+
439
+ Args:
440
+ symbol (str):
441
+ recv_window (Optional[int]):
442
+
443
+ Returns:
444
+ ApiResponse[CancelMarginAccountAllOpenOrdersOnASymbolResponse]
445
+
446
+ Raises:
447
+ RequiredError: If a required parameter is missing.
448
+
449
+ """
450
+
451
+ if symbol is None:
452
+ raise RequiredError(
453
+ field="symbol", error_message="Missing required parameter 'symbol'"
454
+ )
455
+
456
+ payload = {"symbol": symbol, "recv_window": recv_window}
457
+
458
+ return send_request(
459
+ self._session,
460
+ self._configuration,
461
+ method="DELETE",
462
+ path="/papi/v1/margin/allOpenOrders",
463
+ payload=payload,
464
+ time_unit=self._configuration.time_unit,
465
+ response_model=CancelMarginAccountAllOpenOrdersOnASymbolResponse,
466
+ is_signed=True,
467
+ signer=self._signer,
468
+ )
469
+
470
+ def cancel_margin_account_oco_orders(
471
+ self,
472
+ symbol: str = None,
473
+ order_list_id: Optional[int] = None,
474
+ list_client_order_id: Optional[str] = None,
475
+ new_client_order_id: Optional[str] = None,
476
+ recv_window: Optional[int] = None,
477
+ ) -> ApiResponse[CancelMarginAccountOcoOrdersResponse]:
478
+ """
479
+ Cancel Margin Account OCO Orders(TRADE)
480
+ DELETE /papi/v1/margin/orderList
481
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-Margin-Account-OCO-Orders
482
+
483
+ Cancel Margin Account OCO Orders
484
+
485
+ * Additional notes: Canceling an individual leg will cancel the entire OCO
486
+
487
+ Weight: 2
488
+
489
+ Args:
490
+ symbol (str):
491
+ order_list_id (Optional[int]): Either `orderListId` or `listClientOrderId` must be provided
492
+ list_client_order_id (Optional[str]): Either `orderListId` or `listClientOrderId` must be provided
493
+ new_client_order_id (Optional[str]): Used to uniquely identify this cancel. Automatically generated by default
494
+ recv_window (Optional[int]):
495
+
496
+ Returns:
497
+ ApiResponse[CancelMarginAccountOcoOrdersResponse]
498
+
499
+ Raises:
500
+ RequiredError: If a required parameter is missing.
501
+
502
+ """
503
+
504
+ if symbol is None:
505
+ raise RequiredError(
506
+ field="symbol", error_message="Missing required parameter 'symbol'"
507
+ )
508
+
509
+ payload = {
510
+ "symbol": symbol,
511
+ "order_list_id": order_list_id,
512
+ "list_client_order_id": list_client_order_id,
513
+ "new_client_order_id": new_client_order_id,
514
+ "recv_window": recv_window,
515
+ }
516
+
517
+ return send_request(
518
+ self._session,
519
+ self._configuration,
520
+ method="DELETE",
521
+ path="/papi/v1/margin/orderList",
522
+ payload=payload,
523
+ time_unit=self._configuration.time_unit,
524
+ response_model=CancelMarginAccountOcoOrdersResponse,
525
+ is_signed=True,
526
+ signer=self._signer,
527
+ )
528
+
529
+ def cancel_margin_account_order(
530
+ self,
531
+ symbol: str = None,
532
+ order_id: Optional[int] = None,
533
+ orig_client_order_id: Optional[str] = None,
534
+ new_client_order_id: Optional[str] = None,
535
+ recv_window: Optional[int] = None,
536
+ ) -> ApiResponse[CancelMarginAccountOrderResponse]:
537
+ """
538
+ Cancel Margin Account Order(TRADE)
539
+ DELETE /papi/v1/margin/order
540
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-Margin-Account-Order
541
+
542
+ Cancel Margin Account Order
543
+
544
+ * Either `orderId` or `origClientOrderId` must be sent.
545
+
546
+ Weight: 2
547
+
548
+ Args:
549
+ symbol (str):
550
+ order_id (Optional[int]):
551
+ orig_client_order_id (Optional[str]):
552
+ new_client_order_id (Optional[str]): Used to uniquely identify this cancel. Automatically generated by default
553
+ recv_window (Optional[int]):
554
+
555
+ Returns:
556
+ ApiResponse[CancelMarginAccountOrderResponse]
557
+
558
+ Raises:
559
+ RequiredError: If a required parameter is missing.
560
+
561
+ """
562
+
563
+ if symbol is None:
564
+ raise RequiredError(
565
+ field="symbol", error_message="Missing required parameter 'symbol'"
566
+ )
567
+
568
+ payload = {
569
+ "symbol": symbol,
570
+ "order_id": order_id,
571
+ "orig_client_order_id": orig_client_order_id,
572
+ "new_client_order_id": new_client_order_id,
573
+ "recv_window": recv_window,
574
+ }
575
+
576
+ return send_request(
577
+ self._session,
578
+ self._configuration,
579
+ method="DELETE",
580
+ path="/papi/v1/margin/order",
581
+ payload=payload,
582
+ time_unit=self._configuration.time_unit,
583
+ response_model=CancelMarginAccountOrderResponse,
584
+ is_signed=True,
585
+ signer=self._signer,
586
+ )
587
+
588
+ def cancel_um_conditional_order(
589
+ self,
590
+ symbol: str = None,
591
+ strategy_id: Optional[int] = None,
592
+ new_client_strategy_id: Optional[str] = None,
593
+ recv_window: Optional[int] = None,
594
+ ) -> ApiResponse[CancelUmConditionalOrderResponse]:
595
+ """
596
+ Cancel UM Conditional Order(TRADE)
597
+ DELETE /papi/v1/um/conditional/order
598
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-UM-Conditional-Order
599
+
600
+ Cancel UM Conditional Order
601
+
602
+ * Either `strategyId` or `newClientStrategyId` must be sent.
603
+
604
+ Weight: 1
605
+
606
+ Args:
607
+ symbol (str):
608
+ strategy_id (Optional[int]):
609
+ new_client_strategy_id (Optional[str]):
610
+ recv_window (Optional[int]):
611
+
612
+ Returns:
613
+ ApiResponse[CancelUmConditionalOrderResponse]
614
+
615
+ Raises:
616
+ RequiredError: If a required parameter is missing.
617
+
618
+ """
619
+
620
+ if symbol is None:
621
+ raise RequiredError(
622
+ field="symbol", error_message="Missing required parameter 'symbol'"
623
+ )
624
+
625
+ payload = {
626
+ "symbol": symbol,
627
+ "strategy_id": strategy_id,
628
+ "new_client_strategy_id": new_client_strategy_id,
629
+ "recv_window": recv_window,
630
+ }
631
+
632
+ return send_request(
633
+ self._session,
634
+ self._configuration,
635
+ method="DELETE",
636
+ path="/papi/v1/um/conditional/order",
637
+ payload=payload,
638
+ time_unit=self._configuration.time_unit,
639
+ response_model=CancelUmConditionalOrderResponse,
640
+ is_signed=True,
641
+ signer=self._signer,
642
+ )
643
+
644
+ def cancel_um_order(
645
+ self,
646
+ symbol: str = None,
647
+ order_id: Optional[int] = None,
648
+ orig_client_order_id: Optional[str] = None,
649
+ recv_window: Optional[int] = None,
650
+ ) -> ApiResponse[CancelUmOrderResponse]:
651
+ """
652
+ Cancel UM Order(TRADE)
653
+ DELETE /papi/v1/um/order
654
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-UM-Order
655
+
656
+ Cancel an active UM LIMIT order
657
+
658
+ * Either `orderId` or `origClientOrderId` must be sent.
659
+
660
+ Weight: 1
661
+
662
+ Args:
663
+ symbol (str):
664
+ order_id (Optional[int]):
665
+ orig_client_order_id (Optional[str]):
666
+ recv_window (Optional[int]):
667
+
668
+ Returns:
669
+ ApiResponse[CancelUmOrderResponse]
670
+
671
+ Raises:
672
+ RequiredError: If a required parameter is missing.
673
+
674
+ """
675
+
676
+ if symbol is None:
677
+ raise RequiredError(
678
+ field="symbol", error_message="Missing required parameter 'symbol'"
679
+ )
680
+
681
+ payload = {
682
+ "symbol": symbol,
683
+ "order_id": order_id,
684
+ "orig_client_order_id": orig_client_order_id,
685
+ "recv_window": recv_window,
686
+ }
687
+
688
+ return send_request(
689
+ self._session,
690
+ self._configuration,
691
+ method="DELETE",
692
+ path="/papi/v1/um/order",
693
+ payload=payload,
694
+ time_unit=self._configuration.time_unit,
695
+ response_model=CancelUmOrderResponse,
696
+ is_signed=True,
697
+ signer=self._signer,
698
+ )
699
+
700
+ def cm_account_trade_list(
701
+ self,
702
+ symbol: Optional[str] = None,
703
+ pair: Optional[str] = None,
704
+ start_time: Optional[int] = None,
705
+ end_time: Optional[int] = None,
706
+ from_id: Optional[int] = None,
707
+ limit: Optional[int] = None,
708
+ recv_window: Optional[int] = None,
709
+ ) -> ApiResponse[CmAccountTradeListResponse]:
710
+ """
711
+ CM Account Trade List(USER_DATA)
712
+ GET /papi/v1/cm/userTrades
713
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/CM-Account-Trade-List
714
+
715
+ Get trades for a specific account and CM symbol.
716
+
717
+ * Either `symbol` or `pair` must be sent
718
+ * `symbol` and `pair` cannot be sent together
719
+ * `pair` and `fromId` cannot be sent together
720
+ * `OrderId` can only be sent together with symbol
721
+ * If a `pair` is sent, tickers for all symbols of the `pair` will be returned
722
+ * The parameter `fromId` cannot be sent with `startTime` or `endTime`
723
+ * If `startTime` and `endTime` are both not sent, then the last '24 hours' data will be returned.
724
+ * The time between `startTime` and `endTime` cannot be longer than 24 hours.
725
+
726
+ Weight: 20 with symbol, 40 with pair
727
+
728
+ Args:
729
+ symbol (Optional[str]):
730
+ pair (Optional[str]):
731
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
732
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
733
+ from_id (Optional[int]): Trade id to fetch from. Default gets most recent trades.
734
+ limit (Optional[int]): Default 100; max 1000
735
+ recv_window (Optional[int]):
736
+
737
+ Returns:
738
+ ApiResponse[CmAccountTradeListResponse]
739
+
740
+ Raises:
741
+ RequiredError: If a required parameter is missing.
742
+
743
+ """
744
+
745
+ payload = {
746
+ "symbol": symbol,
747
+ "pair": pair,
748
+ "start_time": start_time,
749
+ "end_time": end_time,
750
+ "from_id": from_id,
751
+ "limit": limit,
752
+ "recv_window": recv_window,
753
+ }
754
+
755
+ return send_request(
756
+ self._session,
757
+ self._configuration,
758
+ method="GET",
759
+ path="/papi/v1/cm/userTrades",
760
+ payload=payload,
761
+ time_unit=self._configuration.time_unit,
762
+ response_model=CmAccountTradeListResponse,
763
+ is_signed=True,
764
+ signer=self._signer,
765
+ )
766
+
767
+ def cm_position_adl_quantile_estimation(
768
+ self,
769
+ symbol: Optional[str] = None,
770
+ recv_window: Optional[int] = None,
771
+ ) -> ApiResponse[CmPositionAdlQuantileEstimationResponse]:
772
+ """
773
+ CM Position ADL Quantile Estimation(USER_DATA)
774
+ GET /papi/v1/cm/adlQuantile
775
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/CM-Position-ADL-Quantile-Estimation
776
+
777
+ Query CM Position ADL Quantile Estimation
778
+ * Values update every 30s.
779
+ * Values 0, 1, 2, 3, 4 shows the queue position and possibility of ADL from low to high.
780
+ * For positions of the symbol are in One-way Mode or isolated margined in Hedge Mode, "LONG", "SHORT", and "BOTH" will be returned to show the positions' adl quantiles of different position sides.
781
+ * If the positions of the symbol are crossed margined in Hedge Mode:
782
+ * "HEDGE" as a sign will be returned instead of "BOTH";
783
+ * A same value caculated on unrealized pnls on long and short sides' positions will be shown for "LONG" and "SHORT" when there are positions in both of long and short sides.
784
+
785
+ Weight: 5
786
+
787
+ Args:
788
+ symbol (Optional[str]):
789
+ recv_window (Optional[int]):
790
+
791
+ Returns:
792
+ ApiResponse[CmPositionAdlQuantileEstimationResponse]
793
+
794
+ Raises:
795
+ RequiredError: If a required parameter is missing.
796
+
797
+ """
798
+
799
+ payload = {"symbol": symbol, "recv_window": recv_window}
800
+
801
+ return send_request(
802
+ self._session,
803
+ self._configuration,
804
+ method="GET",
805
+ path="/papi/v1/cm/adlQuantile",
806
+ payload=payload,
807
+ time_unit=self._configuration.time_unit,
808
+ response_model=CmPositionAdlQuantileEstimationResponse,
809
+ is_signed=True,
810
+ signer=self._signer,
811
+ )
812
+
813
+ def get_um_futures_bnb_burn_status(
814
+ self,
815
+ recv_window: Optional[int] = None,
816
+ ) -> ApiResponse[GetUmFuturesBnbBurnStatusResponse]:
817
+ """
818
+ Get UM Futures BNB Burn Status (USER_DATA)
819
+ GET /papi/v1/um/feeBurn
820
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Get-UM-Futures-BNB-Burn-Status
821
+
822
+ Get user's BNB Fee Discount for UM Futures (Fee Discount On or Fee Discount Off )
823
+
824
+ Weight: 30
825
+
826
+ Args:
827
+ recv_window (Optional[int]):
828
+
829
+ Returns:
830
+ ApiResponse[GetUmFuturesBnbBurnStatusResponse]
831
+
832
+ Raises:
833
+ RequiredError: If a required parameter is missing.
834
+
835
+ """
836
+
837
+ payload = {"recv_window": recv_window}
838
+
839
+ return send_request(
840
+ self._session,
841
+ self._configuration,
842
+ method="GET",
843
+ path="/papi/v1/um/feeBurn",
844
+ payload=payload,
845
+ time_unit=self._configuration.time_unit,
846
+ response_model=GetUmFuturesBnbBurnStatusResponse,
847
+ is_signed=True,
848
+ signer=self._signer,
849
+ )
850
+
851
+ def margin_account_borrow(
852
+ self,
853
+ asset: str = None,
854
+ amount: float = None,
855
+ recv_window: Optional[int] = None,
856
+ ) -> ApiResponse[MarginAccountBorrowResponse]:
857
+ """
858
+ Margin Account Borrow(MARGIN)
859
+ POST /papi/v1/marginLoan
860
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Borrow
861
+
862
+ Apply for a margin loan.
863
+
864
+ Weight: 100
865
+
866
+ Args:
867
+ asset (str):
868
+ amount (float):
869
+ recv_window (Optional[int]):
870
+
871
+ Returns:
872
+ ApiResponse[MarginAccountBorrowResponse]
873
+
874
+ Raises:
875
+ RequiredError: If a required parameter is missing.
876
+
877
+ """
878
+
879
+ if asset is None:
880
+ raise RequiredError(
881
+ field="asset", error_message="Missing required parameter 'asset'"
882
+ )
883
+ if amount is None:
884
+ raise RequiredError(
885
+ field="amount", error_message="Missing required parameter 'amount'"
886
+ )
887
+
888
+ payload = {"asset": asset, "amount": amount, "recv_window": recv_window}
889
+
890
+ return send_request(
891
+ self._session,
892
+ self._configuration,
893
+ method="POST",
894
+ path="/papi/v1/marginLoan",
895
+ payload=payload,
896
+ time_unit=self._configuration.time_unit,
897
+ response_model=MarginAccountBorrowResponse,
898
+ is_signed=True,
899
+ signer=self._signer,
900
+ )
901
+
902
+ def margin_account_new_oco(
903
+ self,
904
+ symbol: str = None,
905
+ side: MarginAccountNewOcoSideEnum = None,
906
+ quantity: float = None,
907
+ price: float = None,
908
+ stop_price: float = None,
909
+ list_client_order_id: Optional[str] = None,
910
+ limit_client_order_id: Optional[str] = None,
911
+ limit_iceberg_qty: Optional[float] = None,
912
+ stop_client_order_id: Optional[str] = None,
913
+ stop_limit_price: Optional[float] = None,
914
+ stop_iceberg_qty: Optional[float] = None,
915
+ stop_limit_time_in_force: Optional[
916
+ MarginAccountNewOcoStopLimitTimeInForceEnum
917
+ ] = None,
918
+ new_order_resp_type: Optional[MarginAccountNewOcoNewOrderRespTypeEnum] = None,
919
+ side_effect_type: Optional[MarginAccountNewOcoSideEffectTypeEnum] = None,
920
+ recv_window: Optional[int] = None,
921
+ ) -> ApiResponse[MarginAccountNewOcoResponse]:
922
+ """
923
+ Margin Account New OCO(TRADE)
924
+ POST /papi/v1/margin/order/oco
925
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-New-OCO
926
+
927
+ Send in a new OCO for a margin account
928
+
929
+ * Price Restrictions:
930
+ * `SELL`: Limit Price > Last Price > Stop Price
931
+ * `BUY`: Limit Price < Last Price < Stop Price
932
+ * Quantity Restrictions:
933
+ * Both legs must have the same quantity
934
+ * `ICEBERG` quantities however do not have to be the same.
935
+ * Order Rate Limit
936
+ * `OCO` counts as 2 orders against the order rate limit.
937
+
938
+ Weight: 1
939
+
940
+ Args:
941
+ symbol (str):
942
+ side (MarginAccountNewOcoSideEnum):
943
+ quantity (float): Order quantity
944
+ price (float):
945
+ stop_price (float):
946
+ list_client_order_id (Optional[str]): Either `orderListId` or `listClientOrderId` must be provided
947
+ limit_client_order_id (Optional[str]): A unique Id for the limit order
948
+ limit_iceberg_qty (Optional[float]):
949
+ stop_client_order_id (Optional[str]): A unique Id for the stop loss/stop loss limit leg
950
+ stop_limit_price (Optional[float]): If provided, stopLimitTimeInForce is required.
951
+ stop_iceberg_qty (Optional[float]):
952
+ stop_limit_time_in_force (Optional[MarginAccountNewOcoStopLimitTimeInForceEnum]): Valid values are `GTC/FOK/IOC`
953
+ new_order_resp_type (Optional[MarginAccountNewOcoNewOrderRespTypeEnum]): "ACK", "RESULT", default "ACK"
954
+ side_effect_type (Optional[MarginAccountNewOcoSideEffectTypeEnum]): NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT.
955
+ recv_window (Optional[int]):
956
+
957
+ Returns:
958
+ ApiResponse[MarginAccountNewOcoResponse]
959
+
960
+ Raises:
961
+ RequiredError: If a required parameter is missing.
962
+
963
+ """
964
+
965
+ if symbol is None:
966
+ raise RequiredError(
967
+ field="symbol", error_message="Missing required parameter 'symbol'"
968
+ )
969
+ if side is None:
970
+ raise RequiredError(
971
+ field="side", error_message="Missing required parameter 'side'"
972
+ )
973
+ if quantity is None:
974
+ raise RequiredError(
975
+ field="quantity", error_message="Missing required parameter 'quantity'"
976
+ )
977
+ if price is None:
978
+ raise RequiredError(
979
+ field="price", error_message="Missing required parameter 'price'"
980
+ )
981
+ if stop_price is None:
982
+ raise RequiredError(
983
+ field="stop_price",
984
+ error_message="Missing required parameter 'stop_price'",
985
+ )
986
+
987
+ payload = {
988
+ "symbol": symbol,
989
+ "side": side,
990
+ "quantity": quantity,
991
+ "price": price,
992
+ "stop_price": stop_price,
993
+ "list_client_order_id": list_client_order_id,
994
+ "limit_client_order_id": limit_client_order_id,
995
+ "limit_iceberg_qty": limit_iceberg_qty,
996
+ "stop_client_order_id": stop_client_order_id,
997
+ "stop_limit_price": stop_limit_price,
998
+ "stop_iceberg_qty": stop_iceberg_qty,
999
+ "stop_limit_time_in_force": stop_limit_time_in_force,
1000
+ "new_order_resp_type": new_order_resp_type,
1001
+ "side_effect_type": side_effect_type,
1002
+ "recv_window": recv_window,
1003
+ }
1004
+
1005
+ return send_request(
1006
+ self._session,
1007
+ self._configuration,
1008
+ method="POST",
1009
+ path="/papi/v1/margin/order/oco",
1010
+ payload=payload,
1011
+ time_unit=self._configuration.time_unit,
1012
+ response_model=MarginAccountNewOcoResponse,
1013
+ is_signed=True,
1014
+ signer=self._signer,
1015
+ )
1016
+
1017
+ def margin_account_repay(
1018
+ self,
1019
+ asset: str = None,
1020
+ amount: float = None,
1021
+ recv_window: Optional[int] = None,
1022
+ ) -> ApiResponse[MarginAccountRepayResponse]:
1023
+ """
1024
+ Margin Account Repay(MARGIN)
1025
+ POST /papi/v1/repayLoan
1026
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Repay
1027
+
1028
+ Repay for a margin loan.
1029
+
1030
+ Weight: 100
1031
+
1032
+ Args:
1033
+ asset (str):
1034
+ amount (float):
1035
+ recv_window (Optional[int]):
1036
+
1037
+ Returns:
1038
+ ApiResponse[MarginAccountRepayResponse]
1039
+
1040
+ Raises:
1041
+ RequiredError: If a required parameter is missing.
1042
+
1043
+ """
1044
+
1045
+ if asset is None:
1046
+ raise RequiredError(
1047
+ field="asset", error_message="Missing required parameter 'asset'"
1048
+ )
1049
+ if amount is None:
1050
+ raise RequiredError(
1051
+ field="amount", error_message="Missing required parameter 'amount'"
1052
+ )
1053
+
1054
+ payload = {"asset": asset, "amount": amount, "recv_window": recv_window}
1055
+
1056
+ return send_request(
1057
+ self._session,
1058
+ self._configuration,
1059
+ method="POST",
1060
+ path="/papi/v1/repayLoan",
1061
+ payload=payload,
1062
+ time_unit=self._configuration.time_unit,
1063
+ response_model=MarginAccountRepayResponse,
1064
+ is_signed=True,
1065
+ signer=self._signer,
1066
+ )
1067
+
1068
+ def margin_account_repay_debt(
1069
+ self,
1070
+ asset: str = None,
1071
+ amount: Optional[str] = None,
1072
+ specify_repay_assets: Optional[str] = None,
1073
+ recv_window: Optional[int] = None,
1074
+ ) -> ApiResponse[MarginAccountRepayDebtResponse]:
1075
+ """
1076
+ Margin Account Repay Debt(TRADE)
1077
+ POST /papi/v1/margin/repay-debt
1078
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Repay-Debt
1079
+
1080
+ Repay debt for a margin loan.
1081
+
1082
+ * The repay asset amount cannot exceed 50000 USD equivalent value for a single request.
1083
+ * If `amount` is not sent, all the asset loan will be repaid if having enough specific repay assets.
1084
+ * If `amount` is sent, only the certain amount of the asset loan will be repaid if having enough specific repay assets.
1085
+ * The system will use the same asset to repay the loan first (if have) no matter whether put the asset in `specifyRepayAssets`
1086
+
1087
+ Weight: 3000
1088
+
1089
+ Args:
1090
+ asset (str):
1091
+ amount (Optional[str]):
1092
+ specify_repay_assets (Optional[str]): Specific asset list to repay debt; Can be added in batch, separated by commas
1093
+ recv_window (Optional[int]):
1094
+
1095
+ Returns:
1096
+ ApiResponse[MarginAccountRepayDebtResponse]
1097
+
1098
+ Raises:
1099
+ RequiredError: If a required parameter is missing.
1100
+
1101
+ """
1102
+
1103
+ if asset is None:
1104
+ raise RequiredError(
1105
+ field="asset", error_message="Missing required parameter 'asset'"
1106
+ )
1107
+
1108
+ payload = {
1109
+ "asset": asset,
1110
+ "amount": amount,
1111
+ "specify_repay_assets": specify_repay_assets,
1112
+ "recv_window": recv_window,
1113
+ }
1114
+
1115
+ return send_request(
1116
+ self._session,
1117
+ self._configuration,
1118
+ method="POST",
1119
+ path="/papi/v1/margin/repay-debt",
1120
+ payload=payload,
1121
+ time_unit=self._configuration.time_unit,
1122
+ response_model=MarginAccountRepayDebtResponse,
1123
+ is_signed=True,
1124
+ signer=self._signer,
1125
+ )
1126
+
1127
+ def margin_account_trade_list(
1128
+ self,
1129
+ symbol: str = None,
1130
+ order_id: Optional[int] = None,
1131
+ start_time: Optional[int] = None,
1132
+ end_time: Optional[int] = None,
1133
+ from_id: Optional[int] = None,
1134
+ limit: Optional[int] = None,
1135
+ recv_window: Optional[int] = None,
1136
+ ) -> ApiResponse[MarginAccountTradeListResponse]:
1137
+ """
1138
+ Margin Account Trade List (USER_DATA)
1139
+ GET /papi/v1/margin/myTrades
1140
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Trade-List
1141
+
1142
+ Margin Account Trade List
1143
+
1144
+ Weight: 5
1145
+
1146
+ Args:
1147
+ symbol (str):
1148
+ order_id (Optional[int]):
1149
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
1150
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
1151
+ from_id (Optional[int]): Trade id to fetch from. Default gets most recent trades.
1152
+ limit (Optional[int]): Default 100; max 1000
1153
+ recv_window (Optional[int]):
1154
+
1155
+ Returns:
1156
+ ApiResponse[MarginAccountTradeListResponse]
1157
+
1158
+ Raises:
1159
+ RequiredError: If a required parameter is missing.
1160
+
1161
+ """
1162
+
1163
+ if symbol is None:
1164
+ raise RequiredError(
1165
+ field="symbol", error_message="Missing required parameter 'symbol'"
1166
+ )
1167
+
1168
+ payload = {
1169
+ "symbol": symbol,
1170
+ "order_id": order_id,
1171
+ "start_time": start_time,
1172
+ "end_time": end_time,
1173
+ "from_id": from_id,
1174
+ "limit": limit,
1175
+ "recv_window": recv_window,
1176
+ }
1177
+
1178
+ return send_request(
1179
+ self._session,
1180
+ self._configuration,
1181
+ method="GET",
1182
+ path="/papi/v1/margin/myTrades",
1183
+ payload=payload,
1184
+ time_unit=self._configuration.time_unit,
1185
+ response_model=MarginAccountTradeListResponse,
1186
+ is_signed=True,
1187
+ signer=self._signer,
1188
+ )
1189
+
1190
+ def modify_cm_order(
1191
+ self,
1192
+ symbol: str = None,
1193
+ side: ModifyCmOrderSideEnum = None,
1194
+ quantity: float = None,
1195
+ price: float = None,
1196
+ order_id: Optional[int] = None,
1197
+ orig_client_order_id: Optional[str] = None,
1198
+ price_match: Optional[ModifyCmOrderPriceMatchEnum] = None,
1199
+ recv_window: Optional[int] = None,
1200
+ ) -> ApiResponse[ModifyCmOrderResponse]:
1201
+ """
1202
+ Modify CM Order(TRADE)
1203
+ PUT /papi/v1/cm/order
1204
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-CM-Order
1205
+
1206
+ Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue
1207
+
1208
+ * Either `orderId` or `origClientOrderId` must be sent, and the `orderId` will prevail if both are sent.
1209
+ * Both `quantity` and `price` must be sent
1210
+ * When the new `quantity` or `price` doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is.
1211
+ * However the order will be cancelled by the amendment in the following situations:
1212
+ * when the order is in partially filled status and the new `quantity` <= `executedQty`
1213
+ * When the order is `GTX` and the new price will cause it to be executed immediately
1214
+
1215
+ Weight: 1
1216
+
1217
+ Args:
1218
+ symbol (str):
1219
+ side (ModifyCmOrderSideEnum):
1220
+ quantity (float): Order quantity
1221
+ price (float):
1222
+ order_id (Optional[int]):
1223
+ orig_client_order_id (Optional[str]):
1224
+ price_match (Optional[ModifyCmOrderPriceMatchEnum]): only avaliable for `LIMIT`/`STOP`/`TAKE_PROFIT` order; can be set to `OPPONENT`/ `OPPONENT_5`/ `OPPONENT_10`/ `OPPONENT_20`: /`QUEUE`/ `QUEUE_5`/ `QUEUE_10`/ `QUEUE_20`; Can't be passed together with `price`
1225
+ recv_window (Optional[int]):
1226
+
1227
+ Returns:
1228
+ ApiResponse[ModifyCmOrderResponse]
1229
+
1230
+ Raises:
1231
+ RequiredError: If a required parameter is missing.
1232
+
1233
+ """
1234
+
1235
+ if symbol is None:
1236
+ raise RequiredError(
1237
+ field="symbol", error_message="Missing required parameter 'symbol'"
1238
+ )
1239
+ if side is None:
1240
+ raise RequiredError(
1241
+ field="side", error_message="Missing required parameter 'side'"
1242
+ )
1243
+ if quantity is None:
1244
+ raise RequiredError(
1245
+ field="quantity", error_message="Missing required parameter 'quantity'"
1246
+ )
1247
+ if price is None:
1248
+ raise RequiredError(
1249
+ field="price", error_message="Missing required parameter 'price'"
1250
+ )
1251
+
1252
+ payload = {
1253
+ "symbol": symbol,
1254
+ "side": side,
1255
+ "quantity": quantity,
1256
+ "price": price,
1257
+ "order_id": order_id,
1258
+ "orig_client_order_id": orig_client_order_id,
1259
+ "price_match": price_match,
1260
+ "recv_window": recv_window,
1261
+ }
1262
+
1263
+ return send_request(
1264
+ self._session,
1265
+ self._configuration,
1266
+ method="PUT",
1267
+ path="/papi/v1/cm/order",
1268
+ payload=payload,
1269
+ time_unit=self._configuration.time_unit,
1270
+ response_model=ModifyCmOrderResponse,
1271
+ is_signed=True,
1272
+ signer=self._signer,
1273
+ )
1274
+
1275
+ def modify_um_order(
1276
+ self,
1277
+ symbol: str = None,
1278
+ side: ModifyUmOrderSideEnum = None,
1279
+ quantity: float = None,
1280
+ price: float = None,
1281
+ order_id: Optional[int] = None,
1282
+ orig_client_order_id: Optional[str] = None,
1283
+ price_match: Optional[ModifyUmOrderPriceMatchEnum] = None,
1284
+ recv_window: Optional[int] = None,
1285
+ ) -> ApiResponse[ModifyUmOrderResponse]:
1286
+ """
1287
+ Modify UM Order(TRADE)
1288
+ PUT /papi/v1/um/order
1289
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-UM-Order
1290
+
1291
+ Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue
1292
+
1293
+ * Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent.
1294
+ * Both quantity and price must be sent
1295
+ * When the new quantity or price doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is.
1296
+ * However the order will be cancelled by the amendment in the following situations:
1297
+ * when the order is in partially filled status and the new quantity <= executedQty
1298
+ * When the order is GTX and the new price will cause it to be executed immediately
1299
+
1300
+ Weight: 1
1301
+
1302
+ Args:
1303
+ symbol (str):
1304
+ side (ModifyUmOrderSideEnum):
1305
+ quantity (float): Order quantity
1306
+ price (float):
1307
+ order_id (Optional[int]):
1308
+ orig_client_order_id (Optional[str]):
1309
+ price_match (Optional[ModifyUmOrderPriceMatchEnum]): only avaliable for `LIMIT`/`STOP`/`TAKE_PROFIT` order; can be set to `OPPONENT`/ `OPPONENT_5`/ `OPPONENT_10`/ `OPPONENT_20`: /`QUEUE`/ `QUEUE_5`/ `QUEUE_10`/ `QUEUE_20`; Can't be passed together with `price`
1310
+ recv_window (Optional[int]):
1311
+
1312
+ Returns:
1313
+ ApiResponse[ModifyUmOrderResponse]
1314
+
1315
+ Raises:
1316
+ RequiredError: If a required parameter is missing.
1317
+
1318
+ """
1319
+
1320
+ if symbol is None:
1321
+ raise RequiredError(
1322
+ field="symbol", error_message="Missing required parameter 'symbol'"
1323
+ )
1324
+ if side is None:
1325
+ raise RequiredError(
1326
+ field="side", error_message="Missing required parameter 'side'"
1327
+ )
1328
+ if quantity is None:
1329
+ raise RequiredError(
1330
+ field="quantity", error_message="Missing required parameter 'quantity'"
1331
+ )
1332
+ if price is None:
1333
+ raise RequiredError(
1334
+ field="price", error_message="Missing required parameter 'price'"
1335
+ )
1336
+
1337
+ payload = {
1338
+ "symbol": symbol,
1339
+ "side": side,
1340
+ "quantity": quantity,
1341
+ "price": price,
1342
+ "order_id": order_id,
1343
+ "orig_client_order_id": orig_client_order_id,
1344
+ "price_match": price_match,
1345
+ "recv_window": recv_window,
1346
+ }
1347
+
1348
+ return send_request(
1349
+ self._session,
1350
+ self._configuration,
1351
+ method="PUT",
1352
+ path="/papi/v1/um/order",
1353
+ payload=payload,
1354
+ time_unit=self._configuration.time_unit,
1355
+ response_model=ModifyUmOrderResponse,
1356
+ is_signed=True,
1357
+ signer=self._signer,
1358
+ )
1359
+
1360
+ def new_cm_conditional_order(
1361
+ self,
1362
+ symbol: str = None,
1363
+ side: NewCmConditionalOrderSideEnum = None,
1364
+ strategy_type: NewCmConditionalOrderStrategyTypeEnum = None,
1365
+ position_side: Optional[NewCmConditionalOrderPositionSideEnum] = None,
1366
+ time_in_force: Optional[NewCmConditionalOrderTimeInForceEnum] = None,
1367
+ quantity: Optional[float] = None,
1368
+ reduce_only: Optional[str] = None,
1369
+ price: Optional[float] = None,
1370
+ working_type: Optional[NewCmConditionalOrderWorkingTypeEnum] = None,
1371
+ price_protect: Optional[str] = None,
1372
+ new_client_strategy_id: Optional[str] = None,
1373
+ stop_price: Optional[float] = None,
1374
+ activation_price: Optional[float] = None,
1375
+ callback_rate: Optional[float] = None,
1376
+ recv_window: Optional[int] = None,
1377
+ ) -> ApiResponse[NewCmConditionalOrderResponse]:
1378
+ """
1379
+ New CM Conditional Order(TRADE)
1380
+ POST /papi/v1/cm/conditional/order
1381
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-CM-Conditional-Order
1382
+
1383
+ New CM Conditional Order
1384
+
1385
+ * Order with type `STOP/TAKE_PROFIT`, parameter `timeInForce` can be sent ( default `GTC`).
1386
+ * Condition orders will be triggered when:
1387
+ * `STOP`, `STOP_MARKET`:
1388
+ * BUY: "MARK_PRICE" >= `stopPrice`
1389
+ * SELL: "MARK_PRICE" <= `stopPrice`
1390
+ * `TAKE_PROFIT`, `TAKE_PROFIT_MARKET`:
1391
+ * BUY: "MARK_PRICE" <= `stopPrice`
1392
+ * SELL: "MARK_PRICE" >= `stopPrice`
1393
+ * `TRAILING_STOP_MARKET`:
1394
+ * BUY: the lowest mark price after order placed `<= `activationPrice`, and the latest mark price >`= the lowest mark price * (1 + `callbackRate`)
1395
+ * SELL: the highest mark price after order placed >= `activationPrice`, and the latest mark price <= the highest mark price * (1 - `callbackRate`)
1396
+ * For `TRAILING_STOP_MARKET`, if you got such error code. `{"code": -2021, "msg": "Order would immediately trigger."}` means that the parameters you send do not meet the following requirements:
1397
+ * BUY: `activationPrice` should be smaller than latest mark price.
1398
+ * SELL: `activationPrice` should be larger than latest mark price.
1399
+ * Condition orders will be triggered when:
1400
+ * If parameter`priceProtect`is sent as true:
1401
+ * when price reaches the `stopPrice` ,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol
1402
+ * "triggerProtect" of a symbol can be got from `GET /fapi/v1/exchangeInfo`
1403
+ * `STOP`, `STOP_MARKET`:
1404
+ * BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= `stopPrice`
1405
+ * SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= `stopPrice`
1406
+ * `TAKE_PROFIT`, `TAKE_PROFIT_MARKET`:
1407
+ * BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= `stopPrice`
1408
+ * SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= `stopPrice`
1409
+
1410
+ Weight: 1
1411
+
1412
+ Args:
1413
+ symbol (str):
1414
+ side (NewCmConditionalOrderSideEnum):
1415
+ strategy_type (NewCmConditionalOrderStrategyTypeEnum): "STOP", "STOP_MARKET", "TAKE_PROFIT", "TAKE_PROFIT_MARKET", and "TRAILING_STOP_MARKET"
1416
+ position_side (Optional[NewCmConditionalOrderPositionSideEnum]): Default `BOTH` for One-way Mode ; `LONG` or `SHORT` for Hedge Mode. It must be sent in Hedge Mode.
1417
+ time_in_force (Optional[NewCmConditionalOrderTimeInForceEnum]):
1418
+ quantity (Optional[float]):
1419
+ reduce_only (Optional[str]): "true" or "false". default "false". Cannot be sent in Hedge Mode .
1420
+ price (Optional[float]):
1421
+ working_type (Optional[NewCmConditionalOrderWorkingTypeEnum]): stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE"
1422
+ price_protect (Optional[str]): "TRUE" or "FALSE", default "FALSE". Used with `STOP/STOP_MARKET` or `TAKE_PROFIT/TAKE_PROFIT_MARKET` orders
1423
+ new_client_strategy_id (Optional[str]):
1424
+ stop_price (Optional[float]): Used with `STOP/STOP_MARKET` or `TAKE_PROFIT/TAKE_PROFIT_MARKET` orders.
1425
+ activation_price (Optional[float]): Used with `TRAILING_STOP_MARKET` orders, default as the mark price
1426
+ callback_rate (Optional[float]): Used with `TRAILING_STOP_MARKET` orders, min 0.1, max 5 where 1 for 1%
1427
+ recv_window (Optional[int]):
1428
+
1429
+ Returns:
1430
+ ApiResponse[NewCmConditionalOrderResponse]
1431
+
1432
+ Raises:
1433
+ RequiredError: If a required parameter is missing.
1434
+
1435
+ """
1436
+
1437
+ if symbol is None:
1438
+ raise RequiredError(
1439
+ field="symbol", error_message="Missing required parameter 'symbol'"
1440
+ )
1441
+ if side is None:
1442
+ raise RequiredError(
1443
+ field="side", error_message="Missing required parameter 'side'"
1444
+ )
1445
+ if strategy_type is None:
1446
+ raise RequiredError(
1447
+ field="strategy_type",
1448
+ error_message="Missing required parameter 'strategy_type'",
1449
+ )
1450
+
1451
+ payload = {
1452
+ "symbol": symbol,
1453
+ "side": side,
1454
+ "strategy_type": strategy_type,
1455
+ "position_side": position_side,
1456
+ "time_in_force": time_in_force,
1457
+ "quantity": quantity,
1458
+ "reduce_only": reduce_only,
1459
+ "price": price,
1460
+ "working_type": working_type,
1461
+ "price_protect": price_protect,
1462
+ "new_client_strategy_id": new_client_strategy_id,
1463
+ "stop_price": stop_price,
1464
+ "activation_price": activation_price,
1465
+ "callback_rate": callback_rate,
1466
+ "recv_window": recv_window,
1467
+ }
1468
+
1469
+ return send_request(
1470
+ self._session,
1471
+ self._configuration,
1472
+ method="POST",
1473
+ path="/papi/v1/cm/conditional/order",
1474
+ payload=payload,
1475
+ time_unit=self._configuration.time_unit,
1476
+ response_model=NewCmConditionalOrderResponse,
1477
+ is_signed=True,
1478
+ signer=self._signer,
1479
+ )
1480
+
1481
+ def new_cm_order(
1482
+ self,
1483
+ symbol: str = None,
1484
+ side: NewCmOrderSideEnum = None,
1485
+ type: NewCmOrderTypeEnum = None,
1486
+ position_side: Optional[NewCmOrderPositionSideEnum] = None,
1487
+ time_in_force: Optional[NewCmOrderTimeInForceEnum] = None,
1488
+ quantity: Optional[float] = None,
1489
+ reduce_only: Optional[str] = None,
1490
+ price: Optional[float] = None,
1491
+ price_match: Optional[NewCmOrderPriceMatchEnum] = None,
1492
+ new_client_order_id: Optional[str] = None,
1493
+ new_order_resp_type: Optional[NewCmOrderNewOrderRespTypeEnum] = None,
1494
+ recv_window: Optional[int] = None,
1495
+ ) -> ApiResponse[NewCmOrderResponse]:
1496
+ """
1497
+ New CM Order(TRADE)
1498
+ POST /papi/v1/cm/order
1499
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-CM-Order
1500
+
1501
+ Place new CM order
1502
+
1503
+ * If `newOrderRespType` is sent as `RESULT` :
1504
+ * `MARKET` order: the final FILLED result of the order will be return directly.
1505
+ * `LIMIT` order with special `timeInForce`: the final status result of the order(FILLED or EXPIRED) will be returned directly.
1506
+
1507
+ Weight: 1
1508
+
1509
+ Args:
1510
+ symbol (str):
1511
+ side (NewCmOrderSideEnum):
1512
+ type (NewCmOrderTypeEnum): `LIMIT`, `MARKET`
1513
+ position_side (Optional[NewCmOrderPositionSideEnum]): Default `BOTH` for One-way Mode ; `LONG` or `SHORT` for Hedge Mode. It must be sent in Hedge Mode.
1514
+ time_in_force (Optional[NewCmOrderTimeInForceEnum]):
1515
+ quantity (Optional[float]):
1516
+ reduce_only (Optional[str]): "true" or "false". default "false". Cannot be sent in Hedge Mode .
1517
+ price (Optional[float]):
1518
+ price_match (Optional[NewCmOrderPriceMatchEnum]): only avaliable for `LIMIT`/`STOP`/`TAKE_PROFIT` order; can be set to `OPPONENT`/ `OPPONENT_5`/ `OPPONENT_10`/ `OPPONENT_20`: /`QUEUE`/ `QUEUE_5`/ `QUEUE_10`/ `QUEUE_20`; Can't be passed together with `price`
1519
+ new_client_order_id (Optional[str]): Used to uniquely identify this cancel. Automatically generated by default
1520
+ new_order_resp_type (Optional[NewCmOrderNewOrderRespTypeEnum]): "ACK", "RESULT", default "ACK"
1521
+ recv_window (Optional[int]):
1522
+
1523
+ Returns:
1524
+ ApiResponse[NewCmOrderResponse]
1525
+
1526
+ Raises:
1527
+ RequiredError: If a required parameter is missing.
1528
+
1529
+ """
1530
+
1531
+ if symbol is None:
1532
+ raise RequiredError(
1533
+ field="symbol", error_message="Missing required parameter 'symbol'"
1534
+ )
1535
+ if side is None:
1536
+ raise RequiredError(
1537
+ field="side", error_message="Missing required parameter 'side'"
1538
+ )
1539
+ if type is None:
1540
+ raise RequiredError(
1541
+ field="type", error_message="Missing required parameter 'type'"
1542
+ )
1543
+
1544
+ payload = {
1545
+ "symbol": symbol,
1546
+ "side": side,
1547
+ "type": type,
1548
+ "position_side": position_side,
1549
+ "time_in_force": time_in_force,
1550
+ "quantity": quantity,
1551
+ "reduce_only": reduce_only,
1552
+ "price": price,
1553
+ "price_match": price_match,
1554
+ "new_client_order_id": new_client_order_id,
1555
+ "new_order_resp_type": new_order_resp_type,
1556
+ "recv_window": recv_window,
1557
+ }
1558
+
1559
+ return send_request(
1560
+ self._session,
1561
+ self._configuration,
1562
+ method="POST",
1563
+ path="/papi/v1/cm/order",
1564
+ payload=payload,
1565
+ time_unit=self._configuration.time_unit,
1566
+ response_model=NewCmOrderResponse,
1567
+ is_signed=True,
1568
+ signer=self._signer,
1569
+ )
1570
+
1571
+ def new_margin_order(
1572
+ self,
1573
+ symbol: str = None,
1574
+ side: NewMarginOrderSideEnum = None,
1575
+ type: NewMarginOrderTypeEnum = None,
1576
+ quantity: Optional[float] = None,
1577
+ quote_order_qty: Optional[float] = None,
1578
+ price: Optional[float] = None,
1579
+ stop_price: Optional[float] = None,
1580
+ new_client_order_id: Optional[str] = None,
1581
+ new_order_resp_type: Optional[NewMarginOrderNewOrderRespTypeEnum] = None,
1582
+ iceberg_qty: Optional[float] = None,
1583
+ side_effect_type: Optional[NewMarginOrderSideEffectTypeEnum] = None,
1584
+ time_in_force: Optional[NewMarginOrderTimeInForceEnum] = None,
1585
+ self_trade_prevention_mode: Optional[
1586
+ NewMarginOrderSelfTradePreventionModeEnum
1587
+ ] = None,
1588
+ auto_repay_at_cancel: Optional[bool] = None,
1589
+ recv_window: Optional[int] = None,
1590
+ ) -> ApiResponse[NewMarginOrderResponse]:
1591
+ """
1592
+ New Margin Order(TRADE)
1593
+ POST /papi/v1/margin/order
1594
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-Margin-Order
1595
+
1596
+ New Margin Order
1597
+
1598
+ Weight: 1
1599
+
1600
+ Args:
1601
+ symbol (str):
1602
+ side (NewMarginOrderSideEnum):
1603
+ type (NewMarginOrderTypeEnum): `LIMIT`, `MARKET`
1604
+ quantity (Optional[float]):
1605
+ quote_order_qty (Optional[float]):
1606
+ price (Optional[float]):
1607
+ stop_price (Optional[float]): Used with `STOP/STOP_MARKET` or `TAKE_PROFIT/TAKE_PROFIT_MARKET` orders.
1608
+ new_client_order_id (Optional[str]): Used to uniquely identify this cancel. Automatically generated by default
1609
+ new_order_resp_type (Optional[NewMarginOrderNewOrderRespTypeEnum]): "ACK", "RESULT", default "ACK"
1610
+ iceberg_qty (Optional[float]): Used with `LIMIT`, `STOP_LOSS_LIMIT`, and `TAKE_PROFIT_LIMIT` to create an iceberg order
1611
+ side_effect_type (Optional[NewMarginOrderSideEffectTypeEnum]): NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT.
1612
+ time_in_force (Optional[NewMarginOrderTimeInForceEnum]):
1613
+ self_trade_prevention_mode (Optional[NewMarginOrderSelfTradePreventionModeEnum]): `NONE`:No STP / `EXPIRE_TAKER`:expire taker order when STP triggers/ `EXPIRE_MAKER`:expire taker order when STP triggers/ `EXPIRE_BOTH`:expire both orders when STP triggers
1614
+ auto_repay_at_cancel (Optional[bool]): 只有在自动借款单或者自动借还单生效,true表示的是撤单后需要把订单产生的借款归还,默认为true
1615
+ recv_window (Optional[int]):
1616
+
1617
+ Returns:
1618
+ ApiResponse[NewMarginOrderResponse]
1619
+
1620
+ Raises:
1621
+ RequiredError: If a required parameter is missing.
1622
+
1623
+ """
1624
+
1625
+ if symbol is None:
1626
+ raise RequiredError(
1627
+ field="symbol", error_message="Missing required parameter 'symbol'"
1628
+ )
1629
+ if side is None:
1630
+ raise RequiredError(
1631
+ field="side", error_message="Missing required parameter 'side'"
1632
+ )
1633
+ if type is None:
1634
+ raise RequiredError(
1635
+ field="type", error_message="Missing required parameter 'type'"
1636
+ )
1637
+
1638
+ payload = {
1639
+ "symbol": symbol,
1640
+ "side": side,
1641
+ "type": type,
1642
+ "quantity": quantity,
1643
+ "quote_order_qty": quote_order_qty,
1644
+ "price": price,
1645
+ "stop_price": stop_price,
1646
+ "new_client_order_id": new_client_order_id,
1647
+ "new_order_resp_type": new_order_resp_type,
1648
+ "iceberg_qty": iceberg_qty,
1649
+ "side_effect_type": side_effect_type,
1650
+ "time_in_force": time_in_force,
1651
+ "self_trade_prevention_mode": self_trade_prevention_mode,
1652
+ "auto_repay_at_cancel": auto_repay_at_cancel,
1653
+ "recv_window": recv_window,
1654
+ }
1655
+
1656
+ return send_request(
1657
+ self._session,
1658
+ self._configuration,
1659
+ method="POST",
1660
+ path="/papi/v1/margin/order",
1661
+ payload=payload,
1662
+ time_unit=self._configuration.time_unit,
1663
+ response_model=NewMarginOrderResponse,
1664
+ is_signed=True,
1665
+ signer=self._signer,
1666
+ )
1667
+
1668
+ def new_um_conditional_order(
1669
+ self,
1670
+ symbol: str = None,
1671
+ side: NewUmConditionalOrderSideEnum = None,
1672
+ strategy_type: NewUmConditionalOrderStrategyTypeEnum = None,
1673
+ position_side: Optional[NewUmConditionalOrderPositionSideEnum] = None,
1674
+ time_in_force: Optional[NewUmConditionalOrderTimeInForceEnum] = None,
1675
+ quantity: Optional[float] = None,
1676
+ reduce_only: Optional[str] = None,
1677
+ price: Optional[float] = None,
1678
+ working_type: Optional[NewUmConditionalOrderWorkingTypeEnum] = None,
1679
+ price_protect: Optional[str] = None,
1680
+ new_client_strategy_id: Optional[str] = None,
1681
+ stop_price: Optional[float] = None,
1682
+ activation_price: Optional[float] = None,
1683
+ callback_rate: Optional[float] = None,
1684
+ price_match: Optional[NewUmConditionalOrderPriceMatchEnum] = None,
1685
+ self_trade_prevention_mode: Optional[
1686
+ NewUmConditionalOrderSelfTradePreventionModeEnum
1687
+ ] = None,
1688
+ good_till_date: Optional[int] = None,
1689
+ recv_window: Optional[int] = None,
1690
+ ) -> ApiResponse[NewUmConditionalOrderResponse]:
1691
+ """
1692
+ New UM Conditional Order (TRADE)
1693
+ POST /papi/v1/um/conditional/order
1694
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-UM-Conditional-Order
1695
+
1696
+ Place new UM conditional order
1697
+
1698
+ * Order with type `STOP/TAKE_PROFIT`, parameter `timeInForce` can be sent ( default `GTC`).
1699
+ * Condition orders will be triggered when:
1700
+ * `STOP`, `STOP_MARKET`:
1701
+ * BUY: "MARK_PRICE" >= `stopPrice`
1702
+ * SELL: "MARK_PRICE" <= `stopPrice`
1703
+ * `TAKE_PROFIT`, `TAKE_PROFIT_MARKET`:
1704
+ * BUY: "MARK_PRICE" <= `stopPrice`
1705
+ * SELL: "MARK_PRICE" >= `stopPrice`
1706
+ * `TRAILING_STOP_MARKET`:
1707
+ * BUY: the lowest mark price after order placed `<= `activationPrice`, and the latest mark price >`= the lowest mark price * (1 + `callbackRate`)
1708
+ * SELL: the highest mark price after order placed >= `activationPrice`, and the latest mark price <= the highest mark price * (1 - `callbackRate`)
1709
+ * For `TRAILING_STOP_MARKET`, if you got such error code. `{"code": -2021, "msg": "Order would immediately trigger."}` means that the parameters you send do not meet the following requirements:
1710
+ * BUY: `activationPrice` should be smaller than latest mark price.
1711
+ * SELL: `activationPrice` should be larger than latest mark price.
1712
+ * Condition orders will be triggered when:
1713
+ * If parameter`priceProtect`is sent as true:
1714
+ * when price reaches the `stopPrice` ,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol
1715
+ * "triggerProtect" of a symbol can be got from `GET /fapi/v1/exchangeInfo`
1716
+ * `STOP`, `STOP_MARKET`:
1717
+ * BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= `stopPrice`
1718
+ * SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= `stopPrice`
1719
+ * `TAKE_PROFIT`, `TAKE_PROFIT_MARKET`:
1720
+ * BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= `stopPrice`
1721
+ * SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= `stopPrice`
1722
+ * `selfTradePreventionMode` is only effective when `timeInForce` set to `IOC` or `GTC` or `GTD`.
1723
+ * In extreme market conditions, timeInForce `GTD` order auto cancel time might be delayed comparing to `goodTillDate`
1724
+
1725
+ Weight: 1
1726
+
1727
+ Args:
1728
+ symbol (str):
1729
+ side (NewUmConditionalOrderSideEnum):
1730
+ strategy_type (NewUmConditionalOrderStrategyTypeEnum): "STOP", "STOP_MARKET", "TAKE_PROFIT", "TAKE_PROFIT_MARKET", and "TRAILING_STOP_MARKET"
1731
+ position_side (Optional[NewUmConditionalOrderPositionSideEnum]): Default `BOTH` for One-way Mode ; `LONG` or `SHORT` for Hedge Mode. It must be sent in Hedge Mode.
1732
+ time_in_force (Optional[NewUmConditionalOrderTimeInForceEnum]):
1733
+ quantity (Optional[float]):
1734
+ reduce_only (Optional[str]): "true" or "false". default "false". Cannot be sent in Hedge Mode .
1735
+ price (Optional[float]):
1736
+ working_type (Optional[NewUmConditionalOrderWorkingTypeEnum]): stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE"
1737
+ price_protect (Optional[str]): "TRUE" or "FALSE", default "FALSE". Used with `STOP/STOP_MARKET` or `TAKE_PROFIT/TAKE_PROFIT_MARKET` orders
1738
+ new_client_strategy_id (Optional[str]):
1739
+ stop_price (Optional[float]): Used with `STOP/STOP_MARKET` or `TAKE_PROFIT/TAKE_PROFIT_MARKET` orders.
1740
+ activation_price (Optional[float]): Used with `TRAILING_STOP_MARKET` orders, default as the mark price
1741
+ callback_rate (Optional[float]): Used with `TRAILING_STOP_MARKET` orders, min 0.1, max 5 where 1 for 1%
1742
+ price_match (Optional[NewUmConditionalOrderPriceMatchEnum]): only avaliable for `LIMIT`/`STOP`/`TAKE_PROFIT` order; can be set to `OPPONENT`/ `OPPONENT_5`/ `OPPONENT_10`/ `OPPONENT_20`: /`QUEUE`/ `QUEUE_5`/ `QUEUE_10`/ `QUEUE_20`; Can't be passed together with `price`
1743
+ self_trade_prevention_mode (Optional[NewUmConditionalOrderSelfTradePreventionModeEnum]): `NONE`:No STP / `EXPIRE_TAKER`:expire taker order when STP triggers/ `EXPIRE_MAKER`:expire taker order when STP triggers/ `EXPIRE_BOTH`:expire both orders when STP triggers
1744
+ good_till_date (Optional[int]): order cancel time for timeInForce `GTD`, mandatory when `timeInforce` set to `GTD`; order the timestamp only retains second-level precision, ms part will be ignored; The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000Mode. It must be sent in Hedge Mode.
1745
+ recv_window (Optional[int]):
1746
+
1747
+ Returns:
1748
+ ApiResponse[NewUmConditionalOrderResponse]
1749
+
1750
+ Raises:
1751
+ RequiredError: If a required parameter is missing.
1752
+
1753
+ """
1754
+
1755
+ if symbol is None:
1756
+ raise RequiredError(
1757
+ field="symbol", error_message="Missing required parameter 'symbol'"
1758
+ )
1759
+ if side is None:
1760
+ raise RequiredError(
1761
+ field="side", error_message="Missing required parameter 'side'"
1762
+ )
1763
+ if strategy_type is None:
1764
+ raise RequiredError(
1765
+ field="strategy_type",
1766
+ error_message="Missing required parameter 'strategy_type'",
1767
+ )
1768
+
1769
+ payload = {
1770
+ "symbol": symbol,
1771
+ "side": side,
1772
+ "strategy_type": strategy_type,
1773
+ "position_side": position_side,
1774
+ "time_in_force": time_in_force,
1775
+ "quantity": quantity,
1776
+ "reduce_only": reduce_only,
1777
+ "price": price,
1778
+ "working_type": working_type,
1779
+ "price_protect": price_protect,
1780
+ "new_client_strategy_id": new_client_strategy_id,
1781
+ "stop_price": stop_price,
1782
+ "activation_price": activation_price,
1783
+ "callback_rate": callback_rate,
1784
+ "price_match": price_match,
1785
+ "self_trade_prevention_mode": self_trade_prevention_mode,
1786
+ "good_till_date": good_till_date,
1787
+ "recv_window": recv_window,
1788
+ }
1789
+
1790
+ return send_request(
1791
+ self._session,
1792
+ self._configuration,
1793
+ method="POST",
1794
+ path="/papi/v1/um/conditional/order",
1795
+ payload=payload,
1796
+ time_unit=self._configuration.time_unit,
1797
+ response_model=NewUmConditionalOrderResponse,
1798
+ is_signed=True,
1799
+ signer=self._signer,
1800
+ )
1801
+
1802
+ def new_um_order(
1803
+ self,
1804
+ symbol: str = None,
1805
+ side: NewUmOrderSideEnum = None,
1806
+ type: NewUmOrderTypeEnum = None,
1807
+ position_side: Optional[NewUmOrderPositionSideEnum] = None,
1808
+ time_in_force: Optional[NewUmOrderTimeInForceEnum] = None,
1809
+ quantity: Optional[float] = None,
1810
+ reduce_only: Optional[str] = None,
1811
+ price: Optional[float] = None,
1812
+ new_client_order_id: Optional[str] = None,
1813
+ new_order_resp_type: Optional[NewUmOrderNewOrderRespTypeEnum] = None,
1814
+ price_match: Optional[NewUmOrderPriceMatchEnum] = None,
1815
+ self_trade_prevention_mode: Optional[
1816
+ NewUmOrderSelfTradePreventionModeEnum
1817
+ ] = None,
1818
+ good_till_date: Optional[int] = None,
1819
+ recv_window: Optional[int] = None,
1820
+ ) -> ApiResponse[NewUmOrderResponse]:
1821
+ """
1822
+ New UM Order (TRADE)
1823
+ POST /papi/v1/um/order
1824
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-UM-Order
1825
+
1826
+ Place new UM order
1827
+
1828
+ * If `newOrderRespType` is sent as `RESULT` :
1829
+ * `MARKET` order: the final FILLED result of the order will be return directly.
1830
+ * `LIMIT` order with special `timeInForce`: the final status result of the order(FILLED or EXPIRED) will be returned directly.
1831
+ * `selfTradePreventionMode` is only effective when `timeInForce` set to `IOC` or `GTC` or `GTD`.
1832
+ * In extreme market conditions, timeInForce `GTD` order auto cancel time might be delayed comparing to `goodTillDate`
1833
+
1834
+ Weight: 1
1835
+
1836
+ Args:
1837
+ symbol (str):
1838
+ side (NewUmOrderSideEnum):
1839
+ type (NewUmOrderTypeEnum): `LIMIT`, `MARKET`
1840
+ position_side (Optional[NewUmOrderPositionSideEnum]): Default `BOTH` for One-way Mode ; `LONG` or `SHORT` for Hedge Mode. It must be sent in Hedge Mode.
1841
+ time_in_force (Optional[NewUmOrderTimeInForceEnum]):
1842
+ quantity (Optional[float]):
1843
+ reduce_only (Optional[str]): "true" or "false". default "false". Cannot be sent in Hedge Mode .
1844
+ price (Optional[float]):
1845
+ new_client_order_id (Optional[str]): Used to uniquely identify this cancel. Automatically generated by default
1846
+ new_order_resp_type (Optional[NewUmOrderNewOrderRespTypeEnum]): "ACK", "RESULT", default "ACK"
1847
+ price_match (Optional[NewUmOrderPriceMatchEnum]): only avaliable for `LIMIT`/`STOP`/`TAKE_PROFIT` order; can be set to `OPPONENT`/ `OPPONENT_5`/ `OPPONENT_10`/ `OPPONENT_20`: /`QUEUE`/ `QUEUE_5`/ `QUEUE_10`/ `QUEUE_20`; Can't be passed together with `price`
1848
+ self_trade_prevention_mode (Optional[NewUmOrderSelfTradePreventionModeEnum]): `NONE`:No STP / `EXPIRE_TAKER`:expire taker order when STP triggers/ `EXPIRE_MAKER`:expire taker order when STP triggers/ `EXPIRE_BOTH`:expire both orders when STP triggers
1849
+ good_till_date (Optional[int]): order cancel time for timeInForce `GTD`, mandatory when `timeInforce` set to `GTD`; order the timestamp only retains second-level precision, ms part will be ignored; The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000Mode. It must be sent in Hedge Mode.
1850
+ recv_window (Optional[int]):
1851
+
1852
+ Returns:
1853
+ ApiResponse[NewUmOrderResponse]
1854
+
1855
+ Raises:
1856
+ RequiredError: If a required parameter is missing.
1857
+
1858
+ """
1859
+
1860
+ if symbol is None:
1861
+ raise RequiredError(
1862
+ field="symbol", error_message="Missing required parameter 'symbol'"
1863
+ )
1864
+ if side is None:
1865
+ raise RequiredError(
1866
+ field="side", error_message="Missing required parameter 'side'"
1867
+ )
1868
+ if type is None:
1869
+ raise RequiredError(
1870
+ field="type", error_message="Missing required parameter 'type'"
1871
+ )
1872
+
1873
+ payload = {
1874
+ "symbol": symbol,
1875
+ "side": side,
1876
+ "type": type,
1877
+ "position_side": position_side,
1878
+ "time_in_force": time_in_force,
1879
+ "quantity": quantity,
1880
+ "reduce_only": reduce_only,
1881
+ "price": price,
1882
+ "new_client_order_id": new_client_order_id,
1883
+ "new_order_resp_type": new_order_resp_type,
1884
+ "price_match": price_match,
1885
+ "self_trade_prevention_mode": self_trade_prevention_mode,
1886
+ "good_till_date": good_till_date,
1887
+ "recv_window": recv_window,
1888
+ }
1889
+
1890
+ return send_request(
1891
+ self._session,
1892
+ self._configuration,
1893
+ method="POST",
1894
+ path="/papi/v1/um/order",
1895
+ payload=payload,
1896
+ time_unit=self._configuration.time_unit,
1897
+ response_model=NewUmOrderResponse,
1898
+ is_signed=True,
1899
+ signer=self._signer,
1900
+ )
1901
+
1902
+ def query_all_cm_conditional_orders(
1903
+ self,
1904
+ symbol: Optional[str] = None,
1905
+ strategy_id: Optional[int] = None,
1906
+ start_time: Optional[int] = None,
1907
+ end_time: Optional[int] = None,
1908
+ limit: Optional[int] = None,
1909
+ recv_window: Optional[int] = None,
1910
+ ) -> ApiResponse[QueryAllCmConditionalOrdersResponse]:
1911
+ """
1912
+ Query All CM Conditional Orders(USER_DATA)
1913
+ GET /papi/v1/cm/conditional/allOrders
1914
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Conditional-Orders
1915
+
1916
+ Query All CM Conditional Orders
1917
+
1918
+ * These orders will not be found:
1919
+ * order strategyStatus is `CANCELED` or `EXPIRED`, **AND**
1920
+ * order has NO filled trade, **AND**
1921
+ * created time + 7 days < current time
1922
+ * The query time period must be less than 7 days( default as the recent 7 days).
1923
+
1924
+ Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
1925
+
1926
+ Args:
1927
+ symbol (Optional[str]):
1928
+ strategy_id (Optional[int]):
1929
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
1930
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
1931
+ limit (Optional[int]): Default 100; max 1000
1932
+ recv_window (Optional[int]):
1933
+
1934
+ Returns:
1935
+ ApiResponse[QueryAllCmConditionalOrdersResponse]
1936
+
1937
+ Raises:
1938
+ RequiredError: If a required parameter is missing.
1939
+
1940
+ """
1941
+
1942
+ payload = {
1943
+ "symbol": symbol,
1944
+ "strategy_id": strategy_id,
1945
+ "start_time": start_time,
1946
+ "end_time": end_time,
1947
+ "limit": limit,
1948
+ "recv_window": recv_window,
1949
+ }
1950
+
1951
+ return send_request(
1952
+ self._session,
1953
+ self._configuration,
1954
+ method="GET",
1955
+ path="/papi/v1/cm/conditional/allOrders",
1956
+ payload=payload,
1957
+ time_unit=self._configuration.time_unit,
1958
+ response_model=QueryAllCmConditionalOrdersResponse,
1959
+ is_signed=True,
1960
+ signer=self._signer,
1961
+ )
1962
+
1963
+ def query_all_cm_orders(
1964
+ self,
1965
+ symbol: str = None,
1966
+ pair: Optional[str] = None,
1967
+ order_id: Optional[int] = None,
1968
+ start_time: Optional[int] = None,
1969
+ end_time: Optional[int] = None,
1970
+ limit: Optional[int] = None,
1971
+ recv_window: Optional[int] = None,
1972
+ ) -> ApiResponse[QueryAllCmOrdersResponse]:
1973
+ """
1974
+ Query All CM Orders (USER_DATA)
1975
+ GET /papi/v1/cm/allOrders
1976
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Orders
1977
+
1978
+ Get all account CM orders; active, canceled, or filled.
1979
+
1980
+ * Either `symbol` or `pair` must be sent.
1981
+ * If `orderId` is set, it will get orders >= that orderId. Otherwise most recent orders are returned.
1982
+ * These orders will not be found:
1983
+ * order status is `CANCELED` or `EXPIRED`, **AND**
1984
+ * order has NO filled trade, **AND**
1985
+ * created time + 3 days < current time
1986
+
1987
+ Weight: 20 with symbol, 40 with pair
1988
+
1989
+ Args:
1990
+ symbol (str):
1991
+ pair (Optional[str]):
1992
+ order_id (Optional[int]):
1993
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
1994
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
1995
+ limit (Optional[int]): Default 100; max 1000
1996
+ recv_window (Optional[int]):
1997
+
1998
+ Returns:
1999
+ ApiResponse[QueryAllCmOrdersResponse]
2000
+
2001
+ Raises:
2002
+ RequiredError: If a required parameter is missing.
2003
+
2004
+ """
2005
+
2006
+ if symbol is None:
2007
+ raise RequiredError(
2008
+ field="symbol", error_message="Missing required parameter 'symbol'"
2009
+ )
2010
+
2011
+ payload = {
2012
+ "symbol": symbol,
2013
+ "pair": pair,
2014
+ "order_id": order_id,
2015
+ "start_time": start_time,
2016
+ "end_time": end_time,
2017
+ "limit": limit,
2018
+ "recv_window": recv_window,
2019
+ }
2020
+
2021
+ return send_request(
2022
+ self._session,
2023
+ self._configuration,
2024
+ method="GET",
2025
+ path="/papi/v1/cm/allOrders",
2026
+ payload=payload,
2027
+ time_unit=self._configuration.time_unit,
2028
+ response_model=QueryAllCmOrdersResponse,
2029
+ is_signed=True,
2030
+ signer=self._signer,
2031
+ )
2032
+
2033
+ def query_all_current_cm_open_conditional_orders(
2034
+ self,
2035
+ symbol: Optional[str] = None,
2036
+ recv_window: Optional[int] = None,
2037
+ ) -> ApiResponse[QueryAllCurrentCmOpenConditionalOrdersResponse]:
2038
+ """
2039
+ Query All Current CM Open Conditional Orders (USER_DATA)
2040
+ GET /papi/v1/cm/conditional/openOrders
2041
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-CM-Open-Conditional-Orders
2042
+
2043
+ Get all open conditional orders on a symbol. **Careful** when accessing this with no symbol.
2044
+
2045
+ * If the symbol is not sent, orders for all symbols will be returned in an array.
2046
+
2047
+ Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
2048
+
2049
+ Args:
2050
+ symbol (Optional[str]):
2051
+ recv_window (Optional[int]):
2052
+
2053
+ Returns:
2054
+ ApiResponse[QueryAllCurrentCmOpenConditionalOrdersResponse]
2055
+
2056
+ Raises:
2057
+ RequiredError: If a required parameter is missing.
2058
+
2059
+ """
2060
+
2061
+ payload = {"symbol": symbol, "recv_window": recv_window}
2062
+
2063
+ return send_request(
2064
+ self._session,
2065
+ self._configuration,
2066
+ method="GET",
2067
+ path="/papi/v1/cm/conditional/openOrders",
2068
+ payload=payload,
2069
+ time_unit=self._configuration.time_unit,
2070
+ response_model=QueryAllCurrentCmOpenConditionalOrdersResponse,
2071
+ is_signed=True,
2072
+ signer=self._signer,
2073
+ )
2074
+
2075
+ def query_all_current_cm_open_orders(
2076
+ self,
2077
+ symbol: Optional[str] = None,
2078
+ pair: Optional[str] = None,
2079
+ recv_window: Optional[int] = None,
2080
+ ) -> ApiResponse[QueryAllCurrentCmOpenOrdersResponse]:
2081
+ """
2082
+ Query All Current CM Open Orders(USER_DATA)
2083
+ GET /papi/v1/cm/openOrders
2084
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-CM-Open-Orders
2085
+
2086
+ Get all open orders on a symbol.
2087
+
2088
+ * If the symbol is not sent, orders for all symbols will be returned in an array.
2089
+
2090
+ Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
2091
+ Careful when accessing this with no symbol.
2092
+
2093
+ Args:
2094
+ symbol (Optional[str]):
2095
+ pair (Optional[str]):
2096
+ recv_window (Optional[int]):
2097
+
2098
+ Returns:
2099
+ ApiResponse[QueryAllCurrentCmOpenOrdersResponse]
2100
+
2101
+ Raises:
2102
+ RequiredError: If a required parameter is missing.
2103
+
2104
+ """
2105
+
2106
+ payload = {"symbol": symbol, "pair": pair, "recv_window": recv_window}
2107
+
2108
+ return send_request(
2109
+ self._session,
2110
+ self._configuration,
2111
+ method="GET",
2112
+ path="/papi/v1/cm/openOrders",
2113
+ payload=payload,
2114
+ time_unit=self._configuration.time_unit,
2115
+ response_model=QueryAllCurrentCmOpenOrdersResponse,
2116
+ is_signed=True,
2117
+ signer=self._signer,
2118
+ )
2119
+
2120
+ def query_all_current_um_open_conditional_orders(
2121
+ self,
2122
+ symbol: Optional[str] = None,
2123
+ recv_window: Optional[int] = None,
2124
+ ) -> ApiResponse[QueryAllCurrentUmOpenConditionalOrdersResponse]:
2125
+ """
2126
+ Query All Current UM Open Conditional Orders(USER_DATA)
2127
+ GET /papi/v1/um/conditional/openOrders
2128
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Conditional-Orders
2129
+
2130
+ Get all open conditional orders on a symbol.
2131
+
2132
+ * If the symbol is not sent, orders for all symbols will be returned in an array.
2133
+
2134
+ Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
2135
+ Careful when accessing this with no symbol.
2136
+
2137
+ Args:
2138
+ symbol (Optional[str]):
2139
+ recv_window (Optional[int]):
2140
+
2141
+ Returns:
2142
+ ApiResponse[QueryAllCurrentUmOpenConditionalOrdersResponse]
2143
+
2144
+ Raises:
2145
+ RequiredError: If a required parameter is missing.
2146
+
2147
+ """
2148
+
2149
+ payload = {"symbol": symbol, "recv_window": recv_window}
2150
+
2151
+ return send_request(
2152
+ self._session,
2153
+ self._configuration,
2154
+ method="GET",
2155
+ path="/papi/v1/um/conditional/openOrders",
2156
+ payload=payload,
2157
+ time_unit=self._configuration.time_unit,
2158
+ response_model=QueryAllCurrentUmOpenConditionalOrdersResponse,
2159
+ is_signed=True,
2160
+ signer=self._signer,
2161
+ )
2162
+
2163
+ def query_all_current_um_open_orders(
2164
+ self,
2165
+ symbol: Optional[str] = None,
2166
+ recv_window: Optional[int] = None,
2167
+ ) -> ApiResponse[QueryAllCurrentUmOpenOrdersResponse]:
2168
+ """
2169
+ Query All Current UM Open Orders(USER_DATA)
2170
+ GET /papi/v1/um/openOrders
2171
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Orders
2172
+
2173
+ Get all open orders on a symbol.
2174
+
2175
+
2176
+ * If the symbol is not sent, orders for all symbols will be returned in an array.
2177
+
2178
+ Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
2179
+
2180
+ Args:
2181
+ symbol (Optional[str]):
2182
+ recv_window (Optional[int]):
2183
+
2184
+ Returns:
2185
+ ApiResponse[QueryAllCurrentUmOpenOrdersResponse]
2186
+
2187
+ Raises:
2188
+ RequiredError: If a required parameter is missing.
2189
+
2190
+ """
2191
+
2192
+ payload = {"symbol": symbol, "recv_window": recv_window}
2193
+
2194
+ return send_request(
2195
+ self._session,
2196
+ self._configuration,
2197
+ method="GET",
2198
+ path="/papi/v1/um/openOrders",
2199
+ payload=payload,
2200
+ time_unit=self._configuration.time_unit,
2201
+ response_model=QueryAllCurrentUmOpenOrdersResponse,
2202
+ is_signed=True,
2203
+ signer=self._signer,
2204
+ )
2205
+
2206
+ def query_all_margin_account_orders(
2207
+ self,
2208
+ symbol: str = None,
2209
+ order_id: Optional[int] = None,
2210
+ start_time: Optional[int] = None,
2211
+ end_time: Optional[int] = None,
2212
+ limit: Optional[int] = None,
2213
+ recv_window: Optional[int] = None,
2214
+ ) -> ApiResponse[QueryAllMarginAccountOrdersResponse]:
2215
+ """
2216
+ Query All Margin Account Orders (USER_DATA)
2217
+ GET /papi/v1/margin/allOrders
2218
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Margin-Account-Orders
2219
+
2220
+ Query All Margin Account Orders
2221
+
2222
+ Weight: 100
2223
+
2224
+ Args:
2225
+ symbol (str):
2226
+ order_id (Optional[int]):
2227
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
2228
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
2229
+ limit (Optional[int]): Default 100; max 1000
2230
+ recv_window (Optional[int]):
2231
+
2232
+ Returns:
2233
+ ApiResponse[QueryAllMarginAccountOrdersResponse]
2234
+
2235
+ Raises:
2236
+ RequiredError: If a required parameter is missing.
2237
+
2238
+ """
2239
+
2240
+ if symbol is None:
2241
+ raise RequiredError(
2242
+ field="symbol", error_message="Missing required parameter 'symbol'"
2243
+ )
2244
+
2245
+ payload = {
2246
+ "symbol": symbol,
2247
+ "order_id": order_id,
2248
+ "start_time": start_time,
2249
+ "end_time": end_time,
2250
+ "limit": limit,
2251
+ "recv_window": recv_window,
2252
+ }
2253
+
2254
+ return send_request(
2255
+ self._session,
2256
+ self._configuration,
2257
+ method="GET",
2258
+ path="/papi/v1/margin/allOrders",
2259
+ payload=payload,
2260
+ time_unit=self._configuration.time_unit,
2261
+ response_model=QueryAllMarginAccountOrdersResponse,
2262
+ is_signed=True,
2263
+ signer=self._signer,
2264
+ )
2265
+
2266
+ def query_all_um_conditional_orders(
2267
+ self,
2268
+ symbol: Optional[str] = None,
2269
+ strategy_id: Optional[int] = None,
2270
+ start_time: Optional[int] = None,
2271
+ end_time: Optional[int] = None,
2272
+ limit: Optional[int] = None,
2273
+ recv_window: Optional[int] = None,
2274
+ ) -> ApiResponse[QueryAllUmConditionalOrdersResponse]:
2275
+ """
2276
+ Query All UM Conditional Orders(USER_DATA)
2277
+ GET /papi/v1/um/conditional/allOrders
2278
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Conditional-Orders
2279
+
2280
+ Query All UM Conditional Orders
2281
+
2282
+ * These orders will not be found:
2283
+ * order strategyStatus is `CANCELED` or `EXPIRED`, **AND**
2284
+ * order has NO filled trade, **AND**
2285
+ * created time + 7 days < current time
2286
+ * The query time period must be less than 7 days( default as the recent 7 days).
2287
+
2288
+ Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
2289
+
2290
+ Args:
2291
+ symbol (Optional[str]):
2292
+ strategy_id (Optional[int]):
2293
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
2294
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
2295
+ limit (Optional[int]): Default 100; max 1000
2296
+ recv_window (Optional[int]):
2297
+
2298
+ Returns:
2299
+ ApiResponse[QueryAllUmConditionalOrdersResponse]
2300
+
2301
+ Raises:
2302
+ RequiredError: If a required parameter is missing.
2303
+
2304
+ """
2305
+
2306
+ payload = {
2307
+ "symbol": symbol,
2308
+ "strategy_id": strategy_id,
2309
+ "start_time": start_time,
2310
+ "end_time": end_time,
2311
+ "limit": limit,
2312
+ "recv_window": recv_window,
2313
+ }
2314
+
2315
+ return send_request(
2316
+ self._session,
2317
+ self._configuration,
2318
+ method="GET",
2319
+ path="/papi/v1/um/conditional/allOrders",
2320
+ payload=payload,
2321
+ time_unit=self._configuration.time_unit,
2322
+ response_model=QueryAllUmConditionalOrdersResponse,
2323
+ is_signed=True,
2324
+ signer=self._signer,
2325
+ )
2326
+
2327
+ def query_all_um_orders(
2328
+ self,
2329
+ symbol: str = None,
2330
+ order_id: Optional[int] = None,
2331
+ start_time: Optional[int] = None,
2332
+ end_time: Optional[int] = None,
2333
+ limit: Optional[int] = None,
2334
+ recv_window: Optional[int] = None,
2335
+ ) -> ApiResponse[QueryAllUmOrdersResponse]:
2336
+ """
2337
+ Query All UM Orders(USER_DATA)
2338
+ GET /papi/v1/um/allOrders
2339
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Orders
2340
+
2341
+ Get all account UM orders; active, canceled, or filled.
2342
+ * These orders will not be found:
2343
+ * order status is `CANCELED` or `EXPIRED`, **AND**
2344
+ * order has NO filled trade, **AND**
2345
+ * created time + 3 days < current time
2346
+
2347
+ * If `orderId` is set, it will get orders >= that orderId. Otherwise most recent orders are returned.
2348
+ * The query time period must be less then 7 days( default as the recent 7 days).
2349
+
2350
+ Weight: 5
2351
+
2352
+ Args:
2353
+ symbol (str):
2354
+ order_id (Optional[int]):
2355
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
2356
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
2357
+ limit (Optional[int]): Default 100; max 1000
2358
+ recv_window (Optional[int]):
2359
+
2360
+ Returns:
2361
+ ApiResponse[QueryAllUmOrdersResponse]
2362
+
2363
+ Raises:
2364
+ RequiredError: If a required parameter is missing.
2365
+
2366
+ """
2367
+
2368
+ if symbol is None:
2369
+ raise RequiredError(
2370
+ field="symbol", error_message="Missing required parameter 'symbol'"
2371
+ )
2372
+
2373
+ payload = {
2374
+ "symbol": symbol,
2375
+ "order_id": order_id,
2376
+ "start_time": start_time,
2377
+ "end_time": end_time,
2378
+ "limit": limit,
2379
+ "recv_window": recv_window,
2380
+ }
2381
+
2382
+ return send_request(
2383
+ self._session,
2384
+ self._configuration,
2385
+ method="GET",
2386
+ path="/papi/v1/um/allOrders",
2387
+ payload=payload,
2388
+ time_unit=self._configuration.time_unit,
2389
+ response_model=QueryAllUmOrdersResponse,
2390
+ is_signed=True,
2391
+ signer=self._signer,
2392
+ )
2393
+
2394
+ def query_cm_conditional_order_history(
2395
+ self,
2396
+ symbol: str = None,
2397
+ strategy_id: Optional[int] = None,
2398
+ new_client_strategy_id: Optional[str] = None,
2399
+ recv_window: Optional[int] = None,
2400
+ ) -> ApiResponse[QueryCmConditionalOrderHistoryResponse]:
2401
+ """
2402
+ Query CM Conditional Order History(USER_DATA)
2403
+ GET /papi/v1/cm/conditional/orderHistory
2404
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-CM-Conditional-Order-History
2405
+
2406
+ Query CM Conditional Order History
2407
+
2408
+
2409
+ * Either `strategyId` or `newClientStrategyId` must be sent.
2410
+ * `NEW` orders will not be found.
2411
+ * These orders will not be found:
2412
+ * order status is `CANCELED` or `EXPIRED`, **AND**
2413
+ * order has NO filled trade, **AND**
2414
+ * created time + 7 days < current time
2415
+
2416
+ Weight: 1
2417
+
2418
+ Args:
2419
+ symbol (str):
2420
+ strategy_id (Optional[int]):
2421
+ new_client_strategy_id (Optional[str]):
2422
+ recv_window (Optional[int]):
2423
+
2424
+ Returns:
2425
+ ApiResponse[QueryCmConditionalOrderHistoryResponse]
2426
+
2427
+ Raises:
2428
+ RequiredError: If a required parameter is missing.
2429
+
2430
+ """
2431
+
2432
+ if symbol is None:
2433
+ raise RequiredError(
2434
+ field="symbol", error_message="Missing required parameter 'symbol'"
2435
+ )
2436
+
2437
+ payload = {
2438
+ "symbol": symbol,
2439
+ "strategy_id": strategy_id,
2440
+ "new_client_strategy_id": new_client_strategy_id,
2441
+ "recv_window": recv_window,
2442
+ }
2443
+
2444
+ return send_request(
2445
+ self._session,
2446
+ self._configuration,
2447
+ method="GET",
2448
+ path="/papi/v1/cm/conditional/orderHistory",
2449
+ payload=payload,
2450
+ time_unit=self._configuration.time_unit,
2451
+ response_model=QueryCmConditionalOrderHistoryResponse,
2452
+ is_signed=True,
2453
+ signer=self._signer,
2454
+ )
2455
+
2456
+ def query_cm_modify_order_history(
2457
+ self,
2458
+ symbol: str = None,
2459
+ order_id: Optional[int] = None,
2460
+ orig_client_order_id: Optional[str] = None,
2461
+ start_time: Optional[int] = None,
2462
+ end_time: Optional[int] = None,
2463
+ limit: Optional[int] = None,
2464
+ recv_window: Optional[int] = None,
2465
+ ) -> ApiResponse[QueryCmModifyOrderHistoryResponse]:
2466
+ """
2467
+ Query CM Modify Order History(TRADE)
2468
+ GET /papi/v1/cm/orderAmendment
2469
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-CM-Modify-Order-History
2470
+
2471
+ Get order modification history
2472
+
2473
+ * Either `orderId` or `origClientOrderId` must be sent, and the `orderId` will prevail if both are sent.
2474
+
2475
+ Weight: 1
2476
+
2477
+ Args:
2478
+ symbol (str):
2479
+ order_id (Optional[int]):
2480
+ orig_client_order_id (Optional[str]):
2481
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
2482
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
2483
+ limit (Optional[int]): Default 100; max 1000
2484
+ recv_window (Optional[int]):
2485
+
2486
+ Returns:
2487
+ ApiResponse[QueryCmModifyOrderHistoryResponse]
2488
+
2489
+ Raises:
2490
+ RequiredError: If a required parameter is missing.
2491
+
2492
+ """
2493
+
2494
+ if symbol is None:
2495
+ raise RequiredError(
2496
+ field="symbol", error_message="Missing required parameter 'symbol'"
2497
+ )
2498
+
2499
+ payload = {
2500
+ "symbol": symbol,
2501
+ "order_id": order_id,
2502
+ "orig_client_order_id": orig_client_order_id,
2503
+ "start_time": start_time,
2504
+ "end_time": end_time,
2505
+ "limit": limit,
2506
+ "recv_window": recv_window,
2507
+ }
2508
+
2509
+ return send_request(
2510
+ self._session,
2511
+ self._configuration,
2512
+ method="GET",
2513
+ path="/papi/v1/cm/orderAmendment",
2514
+ payload=payload,
2515
+ time_unit=self._configuration.time_unit,
2516
+ response_model=QueryCmModifyOrderHistoryResponse,
2517
+ is_signed=True,
2518
+ signer=self._signer,
2519
+ )
2520
+
2521
+ def query_cm_order(
2522
+ self,
2523
+ symbol: str = None,
2524
+ order_id: Optional[int] = None,
2525
+ orig_client_order_id: Optional[str] = None,
2526
+ recv_window: Optional[int] = None,
2527
+ ) -> ApiResponse[QueryCmOrderResponse]:
2528
+ """
2529
+ Query CM Order(USER_DATA)
2530
+ GET /papi/v1/cm/order
2531
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-CM-Order
2532
+
2533
+ Check an CM order's status.
2534
+
2535
+ * Either `orderId` or `origClientOrderId` must be sent.
2536
+ * These orders will not be found:
2537
+ * order status is `CANCELED` or `EXPIRED`, **AND**
2538
+ * order has NO filled trade, **AND**
2539
+ * created time + 3 days < current time
2540
+
2541
+ Weight: 1
2542
+
2543
+ Args:
2544
+ symbol (str):
2545
+ order_id (Optional[int]):
2546
+ orig_client_order_id (Optional[str]):
2547
+ recv_window (Optional[int]):
2548
+
2549
+ Returns:
2550
+ ApiResponse[QueryCmOrderResponse]
2551
+
2552
+ Raises:
2553
+ RequiredError: If a required parameter is missing.
2554
+
2555
+ """
2556
+
2557
+ if symbol is None:
2558
+ raise RequiredError(
2559
+ field="symbol", error_message="Missing required parameter 'symbol'"
2560
+ )
2561
+
2562
+ payload = {
2563
+ "symbol": symbol,
2564
+ "order_id": order_id,
2565
+ "orig_client_order_id": orig_client_order_id,
2566
+ "recv_window": recv_window,
2567
+ }
2568
+
2569
+ return send_request(
2570
+ self._session,
2571
+ self._configuration,
2572
+ method="GET",
2573
+ path="/papi/v1/cm/order",
2574
+ payload=payload,
2575
+ time_unit=self._configuration.time_unit,
2576
+ response_model=QueryCmOrderResponse,
2577
+ is_signed=True,
2578
+ signer=self._signer,
2579
+ )
2580
+
2581
+ def query_current_cm_open_conditional_order(
2582
+ self,
2583
+ symbol: str = None,
2584
+ strategy_id: Optional[int] = None,
2585
+ new_client_strategy_id: Optional[str] = None,
2586
+ recv_window: Optional[int] = None,
2587
+ ) -> ApiResponse[QueryCurrentCmOpenConditionalOrderResponse]:
2588
+ """
2589
+ Query Current CM Open Conditional Order(USER_DATA)
2590
+ GET /papi/v1/cm/conditional/openOrder
2591
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-CM-Open-Conditional-Order
2592
+
2593
+ Query Current CM Open Conditional Order
2594
+
2595
+ * Either `strategyId` or `newClientStrategyId` must be sent.
2596
+ * If the queried order has been triggered, cancelled or expired, the error message "Order does not exist" will be returned.
2597
+
2598
+ Weight: 1
2599
+
2600
+ Args:
2601
+ symbol (str):
2602
+ strategy_id (Optional[int]):
2603
+ new_client_strategy_id (Optional[str]):
2604
+ recv_window (Optional[int]):
2605
+
2606
+ Returns:
2607
+ ApiResponse[QueryCurrentCmOpenConditionalOrderResponse]
2608
+
2609
+ Raises:
2610
+ RequiredError: If a required parameter is missing.
2611
+
2612
+ """
2613
+
2614
+ if symbol is None:
2615
+ raise RequiredError(
2616
+ field="symbol", error_message="Missing required parameter 'symbol'"
2617
+ )
2618
+
2619
+ payload = {
2620
+ "symbol": symbol,
2621
+ "strategy_id": strategy_id,
2622
+ "new_client_strategy_id": new_client_strategy_id,
2623
+ "recv_window": recv_window,
2624
+ }
2625
+
2626
+ return send_request(
2627
+ self._session,
2628
+ self._configuration,
2629
+ method="GET",
2630
+ path="/papi/v1/cm/conditional/openOrder",
2631
+ payload=payload,
2632
+ time_unit=self._configuration.time_unit,
2633
+ response_model=QueryCurrentCmOpenConditionalOrderResponse,
2634
+ is_signed=True,
2635
+ signer=self._signer,
2636
+ )
2637
+
2638
+ def query_current_cm_open_order(
2639
+ self,
2640
+ symbol: str = None,
2641
+ order_id: Optional[int] = None,
2642
+ orig_client_order_id: Optional[str] = None,
2643
+ recv_window: Optional[int] = None,
2644
+ ) -> ApiResponse[QueryCurrentCmOpenOrderResponse]:
2645
+ """
2646
+ Query Current CM Open Order (USER_DATA)
2647
+ GET /papi/v1/cm/openOrder
2648
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-CM-Open-Order
2649
+
2650
+ Query current CM open order
2651
+
2652
+ * Either `orderId` or `origClientOrderId` must be sent.
2653
+ * If the queried order has been filled or cancelled, the error message "Order does not exist" will be returned.
2654
+
2655
+ Weight: 1
2656
+
2657
+ Args:
2658
+ symbol (str):
2659
+ order_id (Optional[int]):
2660
+ orig_client_order_id (Optional[str]):
2661
+ recv_window (Optional[int]):
2662
+
2663
+ Returns:
2664
+ ApiResponse[QueryCurrentCmOpenOrderResponse]
2665
+
2666
+ Raises:
2667
+ RequiredError: If a required parameter is missing.
2668
+
2669
+ """
2670
+
2671
+ if symbol is None:
2672
+ raise RequiredError(
2673
+ field="symbol", error_message="Missing required parameter 'symbol'"
2674
+ )
2675
+
2676
+ payload = {
2677
+ "symbol": symbol,
2678
+ "order_id": order_id,
2679
+ "orig_client_order_id": orig_client_order_id,
2680
+ "recv_window": recv_window,
2681
+ }
2682
+
2683
+ return send_request(
2684
+ self._session,
2685
+ self._configuration,
2686
+ method="GET",
2687
+ path="/papi/v1/cm/openOrder",
2688
+ payload=payload,
2689
+ time_unit=self._configuration.time_unit,
2690
+ response_model=QueryCurrentCmOpenOrderResponse,
2691
+ is_signed=True,
2692
+ signer=self._signer,
2693
+ )
2694
+
2695
+ def query_current_margin_open_order(
2696
+ self,
2697
+ symbol: str = None,
2698
+ recv_window: Optional[int] = None,
2699
+ ) -> ApiResponse[QueryCurrentMarginOpenOrderResponse]:
2700
+ """
2701
+ Query Current Margin Open Order (USER_DATA)
2702
+ GET /papi/v1/margin/openOrders
2703
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-Margin-Open-Order
2704
+
2705
+ Query Current Margin Open Order
2706
+
2707
+ Weight: 5
2708
+
2709
+ Args:
2710
+ symbol (str):
2711
+ recv_window (Optional[int]):
2712
+
2713
+ Returns:
2714
+ ApiResponse[QueryCurrentMarginOpenOrderResponse]
2715
+
2716
+ Raises:
2717
+ RequiredError: If a required parameter is missing.
2718
+
2719
+ """
2720
+
2721
+ if symbol is None:
2722
+ raise RequiredError(
2723
+ field="symbol", error_message="Missing required parameter 'symbol'"
2724
+ )
2725
+
2726
+ payload = {"symbol": symbol, "recv_window": recv_window}
2727
+
2728
+ return send_request(
2729
+ self._session,
2730
+ self._configuration,
2731
+ method="GET",
2732
+ path="/papi/v1/margin/openOrders",
2733
+ payload=payload,
2734
+ time_unit=self._configuration.time_unit,
2735
+ response_model=QueryCurrentMarginOpenOrderResponse,
2736
+ is_signed=True,
2737
+ signer=self._signer,
2738
+ )
2739
+
2740
+ def query_current_um_open_conditional_order(
2741
+ self,
2742
+ symbol: str = None,
2743
+ strategy_id: Optional[int] = None,
2744
+ new_client_strategy_id: Optional[str] = None,
2745
+ recv_window: Optional[int] = None,
2746
+ ) -> ApiResponse[QueryCurrentUmOpenConditionalOrderResponse]:
2747
+ """
2748
+ Query Current UM Open Conditional Order(USER_DATA)
2749
+ GET /papi/v1/um/conditional/openOrder
2750
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-UM-Open-Conditional-Order
2751
+
2752
+ Query Current UM Open Conditional Order
2753
+
2754
+ * Either `strategyId` or `newClientStrategyId` must be sent.
2755
+ * If the queried order has been `CANCELED`, `TRIGGERED`或`EXPIRED`, the error message "Order does not exist" will be returned.
2756
+
2757
+ Weight: 1
2758
+
2759
+ Args:
2760
+ symbol (str):
2761
+ strategy_id (Optional[int]):
2762
+ new_client_strategy_id (Optional[str]):
2763
+ recv_window (Optional[int]):
2764
+
2765
+ Returns:
2766
+ ApiResponse[QueryCurrentUmOpenConditionalOrderResponse]
2767
+
2768
+ Raises:
2769
+ RequiredError: If a required parameter is missing.
2770
+
2771
+ """
2772
+
2773
+ if symbol is None:
2774
+ raise RequiredError(
2775
+ field="symbol", error_message="Missing required parameter 'symbol'"
2776
+ )
2777
+
2778
+ payload = {
2779
+ "symbol": symbol,
2780
+ "strategy_id": strategy_id,
2781
+ "new_client_strategy_id": new_client_strategy_id,
2782
+ "recv_window": recv_window,
2783
+ }
2784
+
2785
+ return send_request(
2786
+ self._session,
2787
+ self._configuration,
2788
+ method="GET",
2789
+ path="/papi/v1/um/conditional/openOrder",
2790
+ payload=payload,
2791
+ time_unit=self._configuration.time_unit,
2792
+ response_model=QueryCurrentUmOpenConditionalOrderResponse,
2793
+ is_signed=True,
2794
+ signer=self._signer,
2795
+ )
2796
+
2797
+ def query_current_um_open_order(
2798
+ self,
2799
+ symbol: str = None,
2800
+ order_id: Optional[int] = None,
2801
+ orig_client_order_id: Optional[str] = None,
2802
+ recv_window: Optional[int] = None,
2803
+ ) -> ApiResponse[QueryCurrentUmOpenOrderResponse]:
2804
+ """
2805
+ Query Current UM Open Order(USER_DATA)
2806
+ GET /papi/v1/um/openOrder
2807
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-UM-Open-Order
2808
+
2809
+ Query current UM open order
2810
+
2811
+
2812
+ * Either `orderId` or `origClientOrderId` must be sent.
2813
+ * If the queried order has been filled or cancelled, the error message "Order does not exist" will be returned.
2814
+
2815
+ Weight: 1
2816
+
2817
+ Args:
2818
+ symbol (str):
2819
+ order_id (Optional[int]):
2820
+ orig_client_order_id (Optional[str]):
2821
+ recv_window (Optional[int]):
2822
+
2823
+ Returns:
2824
+ ApiResponse[QueryCurrentUmOpenOrderResponse]
2825
+
2826
+ Raises:
2827
+ RequiredError: If a required parameter is missing.
2828
+
2829
+ """
2830
+
2831
+ if symbol is None:
2832
+ raise RequiredError(
2833
+ field="symbol", error_message="Missing required parameter 'symbol'"
2834
+ )
2835
+
2836
+ payload = {
2837
+ "symbol": symbol,
2838
+ "order_id": order_id,
2839
+ "orig_client_order_id": orig_client_order_id,
2840
+ "recv_window": recv_window,
2841
+ }
2842
+
2843
+ return send_request(
2844
+ self._session,
2845
+ self._configuration,
2846
+ method="GET",
2847
+ path="/papi/v1/um/openOrder",
2848
+ payload=payload,
2849
+ time_unit=self._configuration.time_unit,
2850
+ response_model=QueryCurrentUmOpenOrderResponse,
2851
+ is_signed=True,
2852
+ signer=self._signer,
2853
+ )
2854
+
2855
+ def query_margin_account_order(
2856
+ self,
2857
+ symbol: str = None,
2858
+ order_id: Optional[int] = None,
2859
+ orig_client_order_id: Optional[str] = None,
2860
+ recv_window: Optional[int] = None,
2861
+ ) -> ApiResponse[QueryMarginAccountOrderResponse]:
2862
+ """
2863
+ Query Margin Account Order (USER_DATA)
2864
+ GET /papi/v1/margin/order
2865
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-Order
2866
+
2867
+ Query Margin Account Order
2868
+
2869
+ Weight: 10
2870
+
2871
+ Args:
2872
+ symbol (str):
2873
+ order_id (Optional[int]):
2874
+ orig_client_order_id (Optional[str]):
2875
+ recv_window (Optional[int]):
2876
+
2877
+ Returns:
2878
+ ApiResponse[QueryMarginAccountOrderResponse]
2879
+
2880
+ Raises:
2881
+ RequiredError: If a required parameter is missing.
2882
+
2883
+ """
2884
+
2885
+ if symbol is None:
2886
+ raise RequiredError(
2887
+ field="symbol", error_message="Missing required parameter 'symbol'"
2888
+ )
2889
+
2890
+ payload = {
2891
+ "symbol": symbol,
2892
+ "order_id": order_id,
2893
+ "orig_client_order_id": orig_client_order_id,
2894
+ "recv_window": recv_window,
2895
+ }
2896
+
2897
+ return send_request(
2898
+ self._session,
2899
+ self._configuration,
2900
+ method="GET",
2901
+ path="/papi/v1/margin/order",
2902
+ payload=payload,
2903
+ time_unit=self._configuration.time_unit,
2904
+ response_model=QueryMarginAccountOrderResponse,
2905
+ is_signed=True,
2906
+ signer=self._signer,
2907
+ )
2908
+
2909
+ def query_margin_accounts_all_oco(
2910
+ self,
2911
+ from_id: Optional[int] = None,
2912
+ start_time: Optional[int] = None,
2913
+ end_time: Optional[int] = None,
2914
+ limit: Optional[int] = None,
2915
+ recv_window: Optional[int] = None,
2916
+ ) -> ApiResponse[QueryMarginAccountsAllOcoResponse]:
2917
+ """
2918
+ Query Margin Account's all OCO (USER_DATA)
2919
+ GET /papi/v1/margin/allOrderList
2920
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-all-OCO
2921
+
2922
+ Query all OCO for a specific margin account based on provided optional parameters
2923
+
2924
+ Weight: 100
2925
+
2926
+ Args:
2927
+ from_id (Optional[int]): Trade id to fetch from. Default gets most recent trades.
2928
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
2929
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
2930
+ limit (Optional[int]): Default 100; max 1000
2931
+ recv_window (Optional[int]):
2932
+
2933
+ Returns:
2934
+ ApiResponse[QueryMarginAccountsAllOcoResponse]
2935
+
2936
+ Raises:
2937
+ RequiredError: If a required parameter is missing.
2938
+
2939
+ """
2940
+
2941
+ payload = {
2942
+ "from_id": from_id,
2943
+ "start_time": start_time,
2944
+ "end_time": end_time,
2945
+ "limit": limit,
2946
+ "recv_window": recv_window,
2947
+ }
2948
+
2949
+ return send_request(
2950
+ self._session,
2951
+ self._configuration,
2952
+ method="GET",
2953
+ path="/papi/v1/margin/allOrderList",
2954
+ payload=payload,
2955
+ time_unit=self._configuration.time_unit,
2956
+ response_model=QueryMarginAccountsAllOcoResponse,
2957
+ is_signed=True,
2958
+ signer=self._signer,
2959
+ )
2960
+
2961
+ def query_margin_accounts_oco(
2962
+ self,
2963
+ order_list_id: Optional[int] = None,
2964
+ orig_client_order_id: Optional[str] = None,
2965
+ recv_window: Optional[int] = None,
2966
+ ) -> ApiResponse[QueryMarginAccountsOcoResponse]:
2967
+ """
2968
+ Query Margin Account's OCO (USER_DATA)
2969
+ GET /papi/v1/margin/orderList
2970
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-OCO
2971
+
2972
+ Retrieves a specific OCO based on provided optional parameters
2973
+
2974
+ Weight: 5
2975
+
2976
+ Args:
2977
+ order_list_id (Optional[int]): Either `orderListId` or `listClientOrderId` must be provided
2978
+ orig_client_order_id (Optional[str]):
2979
+ recv_window (Optional[int]):
2980
+
2981
+ Returns:
2982
+ ApiResponse[QueryMarginAccountsOcoResponse]
2983
+
2984
+ Raises:
2985
+ RequiredError: If a required parameter is missing.
2986
+
2987
+ """
2988
+
2989
+ payload = {
2990
+ "order_list_id": order_list_id,
2991
+ "orig_client_order_id": orig_client_order_id,
2992
+ "recv_window": recv_window,
2993
+ }
2994
+
2995
+ return send_request(
2996
+ self._session,
2997
+ self._configuration,
2998
+ method="GET",
2999
+ path="/papi/v1/margin/orderList",
3000
+ payload=payload,
3001
+ time_unit=self._configuration.time_unit,
3002
+ response_model=QueryMarginAccountsOcoResponse,
3003
+ is_signed=True,
3004
+ signer=self._signer,
3005
+ )
3006
+
3007
+ def query_margin_accounts_open_oco(
3008
+ self,
3009
+ recv_window: Optional[int] = None,
3010
+ ) -> ApiResponse[QueryMarginAccountsOpenOcoResponse]:
3011
+ """
3012
+ Query Margin Account's Open OCO (USER_DATA)
3013
+ GET /papi/v1/margin/openOrderList
3014
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Margin-Account-Open-OCO
3015
+
3016
+ Query Margin Account's Open OCO
3017
+
3018
+ Weight: 5
3019
+
3020
+ Args:
3021
+ recv_window (Optional[int]):
3022
+
3023
+ Returns:
3024
+ ApiResponse[QueryMarginAccountsOpenOcoResponse]
3025
+
3026
+ Raises:
3027
+ RequiredError: If a required parameter is missing.
3028
+
3029
+ """
3030
+
3031
+ payload = {"recv_window": recv_window}
3032
+
3033
+ return send_request(
3034
+ self._session,
3035
+ self._configuration,
3036
+ method="GET",
3037
+ path="/papi/v1/margin/openOrderList",
3038
+ payload=payload,
3039
+ time_unit=self._configuration.time_unit,
3040
+ response_model=QueryMarginAccountsOpenOcoResponse,
3041
+ is_signed=True,
3042
+ signer=self._signer,
3043
+ )
3044
+
3045
+ def query_um_conditional_order_history(
3046
+ self,
3047
+ symbol: str = None,
3048
+ strategy_id: Optional[int] = None,
3049
+ new_client_strategy_id: Optional[str] = None,
3050
+ recv_window: Optional[int] = None,
3051
+ ) -> ApiResponse[QueryUmConditionalOrderHistoryResponse]:
3052
+ """
3053
+ Query UM Conditional Order History(USER_DATA)
3054
+ GET /papi/v1/um/conditional/orderHistory
3055
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-UM-Conditional-Order-History
3056
+
3057
+ Query UM Conditional Order History
3058
+
3059
+ * Either `strategyId` or `newClientStrategyId` must be sent.
3060
+ * `NEW` orders will not be found.
3061
+ * These orders will not be found:
3062
+ * order status is `CANCELED` or `EXPIRED`, **AND**
3063
+ * order has NO filled trade, **AND**
3064
+ * created time + 7 days < current time
3065
+
3066
+ Weight: 1
3067
+
3068
+ Args:
3069
+ symbol (str):
3070
+ strategy_id (Optional[int]):
3071
+ new_client_strategy_id (Optional[str]):
3072
+ recv_window (Optional[int]):
3073
+
3074
+ Returns:
3075
+ ApiResponse[QueryUmConditionalOrderHistoryResponse]
3076
+
3077
+ Raises:
3078
+ RequiredError: If a required parameter is missing.
3079
+
3080
+ """
3081
+
3082
+ if symbol is None:
3083
+ raise RequiredError(
3084
+ field="symbol", error_message="Missing required parameter 'symbol'"
3085
+ )
3086
+
3087
+ payload = {
3088
+ "symbol": symbol,
3089
+ "strategy_id": strategy_id,
3090
+ "new_client_strategy_id": new_client_strategy_id,
3091
+ "recv_window": recv_window,
3092
+ }
3093
+
3094
+ return send_request(
3095
+ self._session,
3096
+ self._configuration,
3097
+ method="GET",
3098
+ path="/papi/v1/um/conditional/orderHistory",
3099
+ payload=payload,
3100
+ time_unit=self._configuration.time_unit,
3101
+ response_model=QueryUmConditionalOrderHistoryResponse,
3102
+ is_signed=True,
3103
+ signer=self._signer,
3104
+ )
3105
+
3106
+ def query_um_modify_order_history(
3107
+ self,
3108
+ symbol: str = None,
3109
+ order_id: Optional[int] = None,
3110
+ orig_client_order_id: Optional[str] = None,
3111
+ start_time: Optional[int] = None,
3112
+ end_time: Optional[int] = None,
3113
+ limit: Optional[int] = None,
3114
+ recv_window: Optional[int] = None,
3115
+ ) -> ApiResponse[QueryUmModifyOrderHistoryResponse]:
3116
+ """
3117
+ Query UM Modify Order History(TRADE)
3118
+ GET /papi/v1/um/orderAmendment
3119
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-UM-Modify-Order-History
3120
+
3121
+ Get order modification history
3122
+
3123
+ * Either `orderId` or `origClientOrderId` must be sent, and the `orderId` will prevail if both are sent.
3124
+
3125
+ Weight: 1
3126
+
3127
+ Args:
3128
+ symbol (str):
3129
+ order_id (Optional[int]):
3130
+ orig_client_order_id (Optional[str]):
3131
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
3132
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
3133
+ limit (Optional[int]): Default 100; max 1000
3134
+ recv_window (Optional[int]):
3135
+
3136
+ Returns:
3137
+ ApiResponse[QueryUmModifyOrderHistoryResponse]
3138
+
3139
+ Raises:
3140
+ RequiredError: If a required parameter is missing.
3141
+
3142
+ """
3143
+
3144
+ if symbol is None:
3145
+ raise RequiredError(
3146
+ field="symbol", error_message="Missing required parameter 'symbol'"
3147
+ )
3148
+
3149
+ payload = {
3150
+ "symbol": symbol,
3151
+ "order_id": order_id,
3152
+ "orig_client_order_id": orig_client_order_id,
3153
+ "start_time": start_time,
3154
+ "end_time": end_time,
3155
+ "limit": limit,
3156
+ "recv_window": recv_window,
3157
+ }
3158
+
3159
+ return send_request(
3160
+ self._session,
3161
+ self._configuration,
3162
+ method="GET",
3163
+ path="/papi/v1/um/orderAmendment",
3164
+ payload=payload,
3165
+ time_unit=self._configuration.time_unit,
3166
+ response_model=QueryUmModifyOrderHistoryResponse,
3167
+ is_signed=True,
3168
+ signer=self._signer,
3169
+ )
3170
+
3171
+ def query_um_order(
3172
+ self,
3173
+ symbol: str = None,
3174
+ order_id: Optional[int] = None,
3175
+ orig_client_order_id: Optional[str] = None,
3176
+ recv_window: Optional[int] = None,
3177
+ ) -> ApiResponse[QueryUmOrderResponse]:
3178
+ """
3179
+ Query UM Order (USER_DATA)
3180
+ GET /papi/v1/um/order
3181
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-UM-Order
3182
+
3183
+ Check an UM order's status.
3184
+
3185
+ * These orders will not be found:
3186
+ * Either `orderId` or `origClientOrderId` must be sent.
3187
+ * order status is `CANCELED` or `EXPIRED`, **AND**
3188
+ * order has NO filled trade, **AND**
3189
+ * created time + 3 days < current time
3190
+
3191
+ Weight: 1
3192
+
3193
+ Args:
3194
+ symbol (str):
3195
+ order_id (Optional[int]):
3196
+ orig_client_order_id (Optional[str]):
3197
+ recv_window (Optional[int]):
3198
+
3199
+ Returns:
3200
+ ApiResponse[QueryUmOrderResponse]
3201
+
3202
+ Raises:
3203
+ RequiredError: If a required parameter is missing.
3204
+
3205
+ """
3206
+
3207
+ if symbol is None:
3208
+ raise RequiredError(
3209
+ field="symbol", error_message="Missing required parameter 'symbol'"
3210
+ )
3211
+
3212
+ payload = {
3213
+ "symbol": symbol,
3214
+ "order_id": order_id,
3215
+ "orig_client_order_id": orig_client_order_id,
3216
+ "recv_window": recv_window,
3217
+ }
3218
+
3219
+ return send_request(
3220
+ self._session,
3221
+ self._configuration,
3222
+ method="GET",
3223
+ path="/papi/v1/um/order",
3224
+ payload=payload,
3225
+ time_unit=self._configuration.time_unit,
3226
+ response_model=QueryUmOrderResponse,
3227
+ is_signed=True,
3228
+ signer=self._signer,
3229
+ )
3230
+
3231
+ def query_users_cm_force_orders(
3232
+ self,
3233
+ symbol: Optional[str] = None,
3234
+ auto_close_type: Optional[QueryUsersCmForceOrdersAutoCloseTypeEnum] = None,
3235
+ start_time: Optional[int] = None,
3236
+ end_time: Optional[int] = None,
3237
+ limit: Optional[int] = None,
3238
+ recv_window: Optional[int] = None,
3239
+ ) -> ApiResponse[QueryUsersCmForceOrdersResponse]:
3240
+ """
3241
+ Query User's CM Force Orders(USER_DATA)
3242
+ GET /papi/v1/cm/forceOrders
3243
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Users-CM-Force-Orders
3244
+
3245
+ Query User's CM Force Orders
3246
+
3247
+ * If "autoCloseType" is not sent, orders with both of the types will be returned
3248
+ * If "startTime" is not sent, data within 7 days before "endTime" can be queried
3249
+
3250
+ Weight: 20 with symbol, 50 without symbol
3251
+
3252
+ Args:
3253
+ symbol (Optional[str]):
3254
+ auto_close_type (Optional[QueryUsersCmForceOrdersAutoCloseTypeEnum]): `LIQUIDATION` for liquidation orders, `ADL` for ADL orders.
3255
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
3256
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
3257
+ limit (Optional[int]): Default 100; max 1000
3258
+ recv_window (Optional[int]):
3259
+
3260
+ Returns:
3261
+ ApiResponse[QueryUsersCmForceOrdersResponse]
3262
+
3263
+ Raises:
3264
+ RequiredError: If a required parameter is missing.
3265
+
3266
+ """
3267
+
3268
+ payload = {
3269
+ "symbol": symbol,
3270
+ "auto_close_type": auto_close_type,
3271
+ "start_time": start_time,
3272
+ "end_time": end_time,
3273
+ "limit": limit,
3274
+ "recv_window": recv_window,
3275
+ }
3276
+
3277
+ return send_request(
3278
+ self._session,
3279
+ self._configuration,
3280
+ method="GET",
3281
+ path="/papi/v1/cm/forceOrders",
3282
+ payload=payload,
3283
+ time_unit=self._configuration.time_unit,
3284
+ response_model=QueryUsersCmForceOrdersResponse,
3285
+ is_signed=True,
3286
+ signer=self._signer,
3287
+ )
3288
+
3289
+ def query_users_margin_force_orders(
3290
+ self,
3291
+ start_time: Optional[int] = None,
3292
+ end_time: Optional[int] = None,
3293
+ current: Optional[int] = None,
3294
+ size: Optional[int] = None,
3295
+ recv_window: Optional[int] = None,
3296
+ ) -> ApiResponse[QueryUsersMarginForceOrdersResponse]:
3297
+ """
3298
+ Query User's Margin Force Orders(USER_DATA)
3299
+ GET /papi/v1/margin/forceOrders
3300
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Users-Margin-Force-Orders
3301
+
3302
+ Query user's margin force orders
3303
+
3304
+ Weight: 1
3305
+
3306
+ Args:
3307
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
3308
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
3309
+ current (Optional[int]): Currently querying page. Start from 1. Default:1
3310
+ size (Optional[int]): Default:10 Max:100
3311
+ recv_window (Optional[int]):
3312
+
3313
+ Returns:
3314
+ ApiResponse[QueryUsersMarginForceOrdersResponse]
3315
+
3316
+ Raises:
3317
+ RequiredError: If a required parameter is missing.
3318
+
3319
+ """
3320
+
3321
+ payload = {
3322
+ "start_time": start_time,
3323
+ "end_time": end_time,
3324
+ "current": current,
3325
+ "size": size,
3326
+ "recv_window": recv_window,
3327
+ }
3328
+
3329
+ return send_request(
3330
+ self._session,
3331
+ self._configuration,
3332
+ method="GET",
3333
+ path="/papi/v1/margin/forceOrders",
3334
+ payload=payload,
3335
+ time_unit=self._configuration.time_unit,
3336
+ response_model=QueryUsersMarginForceOrdersResponse,
3337
+ is_signed=True,
3338
+ signer=self._signer,
3339
+ )
3340
+
3341
+ def query_users_um_force_orders(
3342
+ self,
3343
+ symbol: Optional[str] = None,
3344
+ auto_close_type: Optional[QueryUsersUmForceOrdersAutoCloseTypeEnum] = None,
3345
+ start_time: Optional[int] = None,
3346
+ end_time: Optional[int] = None,
3347
+ limit: Optional[int] = None,
3348
+ recv_window: Optional[int] = None,
3349
+ ) -> ApiResponse[QueryUsersUmForceOrdersResponse]:
3350
+ """
3351
+ Query User's UM Force Orders (USER_DATA)
3352
+ GET /papi/v1/um/forceOrders
3353
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Users-UM-Force-Orders
3354
+
3355
+ Query User's UM Force Orders
3356
+
3357
+ * If `autoCloseType` is not sent, orders with both of the types will be returned
3358
+ * If `startTime` is not sent, data within 7 days before `endTime` can be queried
3359
+
3360
+ Weight: 20 with symbol, 50 without symbol
3361
+
3362
+ Args:
3363
+ symbol (Optional[str]):
3364
+ auto_close_type (Optional[QueryUsersUmForceOrdersAutoCloseTypeEnum]): `LIQUIDATION` for liquidation orders, `ADL` for ADL orders.
3365
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
3366
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
3367
+ limit (Optional[int]): Default 100; max 1000
3368
+ recv_window (Optional[int]):
3369
+
3370
+ Returns:
3371
+ ApiResponse[QueryUsersUmForceOrdersResponse]
3372
+
3373
+ Raises:
3374
+ RequiredError: If a required parameter is missing.
3375
+
3376
+ """
3377
+
3378
+ payload = {
3379
+ "symbol": symbol,
3380
+ "auto_close_type": auto_close_type,
3381
+ "start_time": start_time,
3382
+ "end_time": end_time,
3383
+ "limit": limit,
3384
+ "recv_window": recv_window,
3385
+ }
3386
+
3387
+ return send_request(
3388
+ self._session,
3389
+ self._configuration,
3390
+ method="GET",
3391
+ path="/papi/v1/um/forceOrders",
3392
+ payload=payload,
3393
+ time_unit=self._configuration.time_unit,
3394
+ response_model=QueryUsersUmForceOrdersResponse,
3395
+ is_signed=True,
3396
+ signer=self._signer,
3397
+ )
3398
+
3399
+ def toggle_bnb_burn_on_um_futures_trade(
3400
+ self,
3401
+ fee_burn: str = None,
3402
+ recv_window: Optional[int] = None,
3403
+ ) -> ApiResponse[ToggleBnbBurnOnUmFuturesTradeResponse]:
3404
+ """
3405
+ Toggle BNB Burn On UM Futures Trade (TRADE)
3406
+ POST /papi/v1/um/feeBurn
3407
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Toggle-BNB-Burn-On-UM-Futures-Trade
3408
+
3409
+ Change user's BNB Fee Discount for UM Futures (Fee Discount On or Fee Discount Off ) on ***EVERY symbol***
3410
+
3411
+
3412
+ * The BNB would not be collected from UM-PM account to the Portfolio Margin account.
3413
+
3414
+ Weight: 1
3415
+
3416
+ Args:
3417
+ fee_burn (str): "true": Fee Discount On; "false": Fee Discount Off
3418
+ recv_window (Optional[int]):
3419
+
3420
+ Returns:
3421
+ ApiResponse[ToggleBnbBurnOnUmFuturesTradeResponse]
3422
+
3423
+ Raises:
3424
+ RequiredError: If a required parameter is missing.
3425
+
3426
+ """
3427
+
3428
+ if fee_burn is None:
3429
+ raise RequiredError(
3430
+ field="fee_burn", error_message="Missing required parameter 'fee_burn'"
3431
+ )
3432
+
3433
+ payload = {"fee_burn": fee_burn, "recv_window": recv_window}
3434
+
3435
+ return send_request(
3436
+ self._session,
3437
+ self._configuration,
3438
+ method="POST",
3439
+ path="/papi/v1/um/feeBurn",
3440
+ payload=payload,
3441
+ time_unit=self._configuration.time_unit,
3442
+ response_model=ToggleBnbBurnOnUmFuturesTradeResponse,
3443
+ is_signed=True,
3444
+ signer=self._signer,
3445
+ )
3446
+
3447
+ def um_account_trade_list(
3448
+ self,
3449
+ symbol: str = None,
3450
+ start_time: Optional[int] = None,
3451
+ end_time: Optional[int] = None,
3452
+ from_id: Optional[int] = None,
3453
+ limit: Optional[int] = None,
3454
+ recv_window: Optional[int] = None,
3455
+ ) -> ApiResponse[UmAccountTradeListResponse]:
3456
+ """
3457
+ UM Account Trade List(USER_DATA)
3458
+ GET /papi/v1/um/userTrades
3459
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/UM-Account-Trade-List
3460
+
3461
+ Get trades for a specific account and UM symbol.
3462
+
3463
+
3464
+ * If `startTime` and `endTime` are both not sent, then the last '7 days' data will be returned.
3465
+ * The time between `startTime` and `endTime` cannot be longer than 7 days.
3466
+ * The parameter `fromId` cannot be sent with `startTime` or `endTime`.
3467
+
3468
+ Weight: 5
3469
+
3470
+ Args:
3471
+ symbol (str):
3472
+ start_time (Optional[int]): Timestamp in ms to get funding from INCLUSIVE.
3473
+ end_time (Optional[int]): Timestamp in ms to get funding until INCLUSIVE.
3474
+ from_id (Optional[int]): Trade id to fetch from. Default gets most recent trades.
3475
+ limit (Optional[int]): Default 100; max 1000
3476
+ recv_window (Optional[int]):
3477
+
3478
+ Returns:
3479
+ ApiResponse[UmAccountTradeListResponse]
3480
+
3481
+ Raises:
3482
+ RequiredError: If a required parameter is missing.
3483
+
3484
+ """
3485
+
3486
+ if symbol is None:
3487
+ raise RequiredError(
3488
+ field="symbol", error_message="Missing required parameter 'symbol'"
3489
+ )
3490
+
3491
+ payload = {
3492
+ "symbol": symbol,
3493
+ "start_time": start_time,
3494
+ "end_time": end_time,
3495
+ "from_id": from_id,
3496
+ "limit": limit,
3497
+ "recv_window": recv_window,
3498
+ }
3499
+
3500
+ return send_request(
3501
+ self._session,
3502
+ self._configuration,
3503
+ method="GET",
3504
+ path="/papi/v1/um/userTrades",
3505
+ payload=payload,
3506
+ time_unit=self._configuration.time_unit,
3507
+ response_model=UmAccountTradeListResponse,
3508
+ is_signed=True,
3509
+ signer=self._signer,
3510
+ )
3511
+
3512
+ def um_position_adl_quantile_estimation(
3513
+ self,
3514
+ symbol: Optional[str] = None,
3515
+ recv_window: Optional[int] = None,
3516
+ ) -> ApiResponse[UmPositionAdlQuantileEstimationResponse]:
3517
+ """
3518
+ UM Position ADL Quantile Estimation(USER_DATA)
3519
+ GET /papi/v1/um/adlQuantile
3520
+ https://developers.binance.com/docs/derivatives/portfolio-margin/trade/UM-Position-ADL-Quantile-Estimation
3521
+
3522
+ Query UM Position ADL Quantile Estimation
3523
+
3524
+ * Values update every 30s.
3525
+ * Values 0, 1, 2, 3, 4 shows the queue position and possibility of ADL from low to high.
3526
+ * For positions of the symbol are in One-way Mode or isolated margined in Hedge Mode, "LONG", "SHORT", and "BOTH" will be returned to show the positions' adl quantiles of different position sides.
3527
+ * If the positions of the symbol are crossed margined in Hedge Mode:
3528
+ * "HEDGE" as a sign will be returned instead of "BOTH";
3529
+ * A same value caculated on unrealized pnls on long and short sides' positions will be shown for "LONG" and "SHORT" when there are positions in both of long and short sides.
3530
+
3531
+ Weight: 5
3532
+
3533
+ Args:
3534
+ symbol (Optional[str]):
3535
+ recv_window (Optional[int]):
3536
+
3537
+ Returns:
3538
+ ApiResponse[UmPositionAdlQuantileEstimationResponse]
3539
+
3540
+ Raises:
3541
+ RequiredError: If a required parameter is missing.
3542
+
3543
+ """
3544
+
3545
+ payload = {"symbol": symbol, "recv_window": recv_window}
3546
+
3547
+ return send_request(
3548
+ self._session,
3549
+ self._configuration,
3550
+ method="GET",
3551
+ path="/papi/v1/um/adlQuantile",
3552
+ payload=payload,
3553
+ time_unit=self._configuration.time_unit,
3554
+ response_model=UmPositionAdlQuantileEstimationResponse,
3555
+ is_signed=True,
3556
+ signer=self._signer,
3557
+ )