whitebit-python-sdk 1.1.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.
Files changed (451) hide show
  1. whitebit/__init__.py +793 -0
  2. whitebit/client.py +580 -0
  3. whitebit/codes/__init__.py +7 -0
  4. whitebit/codes/client.py +510 -0
  5. whitebit/codes/raw_client.py +809 -0
  6. whitebit/codes/types/__init__.py +10 -0
  7. whitebit/codes/types/apply_code_response.py +22 -0
  8. whitebit/codes/types/create_code_response.py +32 -0
  9. whitebit/codes/types/get_codes_history_response.py +27 -0
  10. whitebit/codes/types/get_my_codes_response.py +27 -0
  11. whitebit/collateral_trading/__init__.py +183 -0
  12. whitebit/collateral_trading/client.py +2452 -0
  13. whitebit/collateral_trading/raw_client.py +4337 -0
  14. whitebit/collateral_trading/types/__init__.py +213 -0
  15. whitebit/collateral_trading/types/cancel_oco_order_response.py +34 -0
  16. whitebit/collateral_trading/types/cancel_oco_order_response_stop_loss.py +146 -0
  17. whitebit/collateral_trading/types/cancel_oco_order_response_stop_loss_activation_condition.py +5 -0
  18. whitebit/collateral_trading/types/cancel_oco_order_response_stop_loss_side.py +5 -0
  19. whitebit/collateral_trading/types/cancel_oco_order_response_take_profit.py +114 -0
  20. whitebit/collateral_trading/types/cancel_oco_order_response_take_profit_side.py +5 -0
  21. whitebit/collateral_trading/types/change_collateral_account_leverage_response.py +22 -0
  22. whitebit/collateral_trading/types/close_position_request_position_side.py +5 -0
  23. whitebit/collateral_trading/types/collateral_account_balance_summary_response_item.py +48 -0
  24. whitebit/collateral_trading/types/collateral_account_summary_response.py +60 -0
  25. whitebit/collateral_trading/types/create_collateral_bulk_order_request_orders_item.py +98 -0
  26. whitebit/collateral_trading/types/create_collateral_bulk_order_request_orders_item_position_side.py +7 -0
  27. whitebit/collateral_trading/types/create_collateral_bulk_order_request_orders_item_side.py +5 -0
  28. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item.py +29 -0
  29. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item_error.py +36 -0
  30. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item_result.py +132 -0
  31. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item_result_position_side.py +7 -0
  32. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item_result_side.py +5 -0
  33. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item_result_status.py +7 -0
  34. whitebit/collateral_trading/types/create_collateral_limit_order_request_position_side.py +5 -0
  35. whitebit/collateral_trading/types/create_collateral_limit_order_request_side.py +5 -0
  36. whitebit/collateral_trading/types/create_collateral_limit_order_response.py +132 -0
  37. whitebit/collateral_trading/types/create_collateral_limit_order_response_oto.py +44 -0
  38. whitebit/collateral_trading/types/create_collateral_limit_order_response_position_side.py +5 -0
  39. whitebit/collateral_trading/types/create_collateral_limit_order_response_side.py +5 -0
  40. whitebit/collateral_trading/types/create_collateral_limit_order_response_status.py +7 -0
  41. whitebit/collateral_trading/types/create_collateral_market_order_request_position_side.py +5 -0
  42. whitebit/collateral_trading/types/create_collateral_market_order_request_side.py +5 -0
  43. whitebit/collateral_trading/types/create_collateral_market_order_response.py +110 -0
  44. whitebit/collateral_trading/types/create_collateral_market_order_response_oto.py +44 -0
  45. whitebit/collateral_trading/types/create_collateral_market_order_response_position_side.py +5 -0
  46. whitebit/collateral_trading/types/create_collateral_market_order_response_side.py +5 -0
  47. whitebit/collateral_trading/types/create_collateral_market_order_response_status.py +7 -0
  48. whitebit/collateral_trading/types/create_collateral_oco_order_request_side.py +5 -0
  49. whitebit/collateral_trading/types/create_collateral_oco_order_response.py +34 -0
  50. whitebit/collateral_trading/types/create_collateral_oco_order_response_stop_loss.py +159 -0
  51. whitebit/collateral_trading/types/create_collateral_oco_order_response_stop_loss_activation_condition.py +5 -0
  52. whitebit/collateral_trading/types/create_collateral_oco_order_response_stop_loss_position_side.py +5 -0
  53. whitebit/collateral_trading/types/create_collateral_oco_order_response_stop_loss_side.py +5 -0
  54. whitebit/collateral_trading/types/create_collateral_oco_order_response_stop_loss_status.py +7 -0
  55. whitebit/collateral_trading/types/create_collateral_oco_order_response_take_profit.py +139 -0
  56. whitebit/collateral_trading/types/create_collateral_oco_order_response_take_profit_position_side.py +7 -0
  57. whitebit/collateral_trading/types/create_collateral_oco_order_response_take_profit_side.py +5 -0
  58. whitebit/collateral_trading/types/create_collateral_oco_order_response_take_profit_status.py +7 -0
  59. whitebit/collateral_trading/types/create_collateral_stop_limit_order_request_position_side.py +5 -0
  60. whitebit/collateral_trading/types/create_collateral_stop_limit_order_request_side.py +5 -0
  61. whitebit/collateral_trading/types/create_collateral_stop_limit_order_response.py +122 -0
  62. whitebit/collateral_trading/types/create_collateral_stop_limit_order_response_oto.py +44 -0
  63. whitebit/collateral_trading/types/create_collateral_stop_limit_order_response_position_side.py +5 -0
  64. whitebit/collateral_trading/types/create_collateral_stop_limit_order_response_side.py +5 -0
  65. whitebit/collateral_trading/types/create_collateral_stop_limit_order_response_status.py +7 -0
  66. whitebit/collateral_trading/types/create_collateral_trigger_market_order_request_position_side.py +7 -0
  67. whitebit/collateral_trading/types/create_collateral_trigger_market_order_request_side.py +5 -0
  68. whitebit/collateral_trading/types/create_collateral_trigger_market_order_response.py +117 -0
  69. whitebit/collateral_trading/types/create_collateral_trigger_market_order_response_oto.py +44 -0
  70. whitebit/collateral_trading/types/create_collateral_trigger_market_order_response_position_side.py +7 -0
  71. whitebit/collateral_trading/types/create_collateral_trigger_market_order_response_side.py +5 -0
  72. whitebit/collateral_trading/types/create_collateral_trigger_market_order_response_status.py +7 -0
  73. whitebit/collateral_trading/types/get_collateral_hedge_mode_response.py +26 -0
  74. whitebit/collateral_trading/types/get_conditional_orders_response.py +38 -0
  75. whitebit/collateral_trading/types/get_conditional_orders_response_records_item.py +60 -0
  76. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oco.py +31 -0
  77. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oco_stop_loss.py +28 -0
  78. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oco_stop_loss_position_side.py +7 -0
  79. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oco_take_profit.py +28 -0
  80. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oco_take_profit_position_side.py +7 -0
  81. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oto.py +34 -0
  82. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oto_conditional_order.py +30 -0
  83. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oto_conditional_order_position_side.py +7 -0
  84. whitebit/collateral_trading/types/get_funding_history_response.py +33 -0
  85. whitebit/collateral_trading/types/get_funding_history_response_records_item.py +66 -0
  86. whitebit/collateral_trading/types/get_oco_orders_response_item.py +34 -0
  87. whitebit/collateral_trading/types/get_oco_orders_response_item_stop_loss.py +49 -0
  88. whitebit/collateral_trading/types/get_oco_orders_response_item_stop_loss_activation_condition.py +5 -0
  89. whitebit/collateral_trading/types/get_oco_orders_response_item_stop_loss_side.py +5 -0
  90. whitebit/collateral_trading/types/get_oco_orders_response_item_take_profit.py +43 -0
  91. whitebit/collateral_trading/types/get_oco_orders_response_item_take_profit_side.py +5 -0
  92. whitebit/collateral_trading/types/get_open_positions_response_item.py +136 -0
  93. whitebit/collateral_trading/types/get_open_positions_response_item_liquidation_state.py +5 -0
  94. whitebit/collateral_trading/types/get_open_positions_response_item_position_side.py +5 -0
  95. whitebit/collateral_trading/types/get_open_positions_response_item_tpsl.py +51 -0
  96. whitebit/collateral_trading/types/get_positions_history_response_item.py +95 -0
  97. whitebit/collateral_trading/types/get_positions_history_response_item_liquidation_state.py +5 -0
  98. whitebit/collateral_trading/types/get_positions_history_response_item_order_detail.py +61 -0
  99. whitebit/collateral_trading/types/get_positions_history_response_item_position_side.py +5 -0
  100. whitebit/core/__init__.py +52 -0
  101. whitebit/core/api_error.py +23 -0
  102. whitebit/core/client_wrapper.py +57 -0
  103. whitebit/core/datetime_utils.py +28 -0
  104. whitebit/core/file.py +67 -0
  105. whitebit/core/http_client.py +497 -0
  106. whitebit/core/http_response.py +55 -0
  107. whitebit/core/jsonable_encoder.py +100 -0
  108. whitebit/core/pydantic_utilities.py +255 -0
  109. whitebit/core/query_encoder.py +58 -0
  110. whitebit/core/remove_none_from_dict.py +11 -0
  111. whitebit/core/request_options.py +35 -0
  112. whitebit/core/serialization.py +276 -0
  113. whitebit/credit_line/__init__.py +4 -0
  114. whitebit/credit_line/client.py +128 -0
  115. whitebit/credit_line/raw_client.py +191 -0
  116. whitebit/crypto_lending_fixed/__init__.py +7 -0
  117. whitebit/crypto_lending_fixed/client.py +651 -0
  118. whitebit/crypto_lending_fixed/raw_client.py +931 -0
  119. whitebit/crypto_lending_fixed/types/__init__.py +9 -0
  120. whitebit/crypto_lending_fixed/types/create_fixed_investment_response.py +22 -0
  121. whitebit/crypto_lending_fixed/types/get_fixed_investments_history_response.py +22 -0
  122. whitebit/crypto_lending_fixed/types/get_interest_payment_history_response.py +22 -0
  123. whitebit/crypto_lending_flex/__init__.py +29 -0
  124. whitebit/crypto_lending_flex/client.py +1140 -0
  125. whitebit/crypto_lending_flex/raw_client.py +1651 -0
  126. whitebit/crypto_lending_flex/types/__init__.py +27 -0
  127. whitebit/crypto_lending_flex/types/close_flex_investment_response.py +20 -0
  128. whitebit/crypto_lending_flex/types/close_flex_investment_response_data.py +26 -0
  129. whitebit/crypto_lending_flex/types/create_flex_investment_response.py +20 -0
  130. whitebit/crypto_lending_flex/types/create_flex_investment_response_data.py +26 -0
  131. whitebit/crypto_lending_flex/types/get_flex_investment_history_response.py +22 -0
  132. whitebit/crypto_lending_flex/types/get_flex_payment_history_response.py +22 -0
  133. whitebit/crypto_lending_flex/types/get_user_flex_investments_response.py +22 -0
  134. whitebit/crypto_lending_flex/types/update_flex_auto_reinvestment_response.py +19 -0
  135. whitebit/crypto_lending_flex/types/withdraw_from_flex_investment_response.py +20 -0
  136. whitebit/crypto_lending_flex/types/withdraw_from_flex_investment_response_data.py +26 -0
  137. whitebit/deposit/__init__.py +35 -0
  138. whitebit/deposit/client.py +997 -0
  139. whitebit/deposit/raw_client.py +1342 -0
  140. whitebit/deposit/types/__init__.py +33 -0
  141. whitebit/deposit/types/create_new_address_request_type.py +5 -0
  142. whitebit/deposit/types/create_new_address_response.py +22 -0
  143. whitebit/deposit/types/create_new_address_response_account.py +27 -0
  144. whitebit/deposit/types/create_new_address_response_required.py +48 -0
  145. whitebit/deposit/types/create_new_address_response_required_flex_fee.py +42 -0
  146. whitebit/deposit/types/get_deposit_address_response.py +22 -0
  147. whitebit/deposit/types/get_deposit_address_response_account.py +27 -0
  148. whitebit/deposit/types/get_deposit_address_response_required.py +48 -0
  149. whitebit/deposit/types/get_deposit_address_response_required_flex_fee.py +42 -0
  150. whitebit/deposit/types/get_fiat_deposit_url_request_customer.py +61 -0
  151. whitebit/deposit/types/get_fiat_deposit_url_request_customer_address.py +56 -0
  152. whitebit/deposit/types/get_fiat_deposit_url_response.py +22 -0
  153. whitebit/deposit/types/refund_deposit_response.py +22 -0
  154. whitebit/environment.py +17 -0
  155. whitebit/errors/__init__.py +19 -0
  156. whitebit/errors/bad_request_error.py +10 -0
  157. whitebit/errors/internal_server_error.py +10 -0
  158. whitebit/errors/not_found_error.py +11 -0
  159. whitebit/errors/service_unavailable_error.py +10 -0
  160. whitebit/errors/unauthorized_error.py +10 -0
  161. whitebit/errors/unprocessable_entity_error.py +10 -0
  162. whitebit/fees/__init__.py +4 -0
  163. whitebit/fees/client.py +126 -0
  164. whitebit/fees/raw_client.py +144 -0
  165. whitebit/jwt/__init__.py +7 -0
  166. whitebit/jwt/client.py +224 -0
  167. whitebit/jwt/raw_client.py +389 -0
  168. whitebit/jwt/types/__init__.py +9 -0
  169. whitebit/jwt/types/get_web_socket_token_response.py +22 -0
  170. whitebit/jwt/types/issue_jwt_token_response.py +20 -0
  171. whitebit/jwt/types/issue_jwt_token_response_data.py +27 -0
  172. whitebit/main_account/__init__.py +7 -0
  173. whitebit/main_account/client.py +380 -0
  174. whitebit/main_account/raw_client.py +493 -0
  175. whitebit/main_account/types/__init__.py +8 -0
  176. whitebit/main_account/types/get_deposit_withdraw_history_response.py +26 -0
  177. whitebit/main_account/types/get_main_balance_response_value.py +22 -0
  178. whitebit/market_fee/__init__.py +7 -0
  179. whitebit/market_fee/client.py +193 -0
  180. whitebit/market_fee/raw_client.py +267 -0
  181. whitebit/market_fee/types/__init__.py +8 -0
  182. whitebit/market_fee/types/get_all_market_fees_response.py +43 -0
  183. whitebit/market_fee/types/get_market_fee_response.py +38 -0
  184. whitebit/mining_pool/__init__.py +67 -0
  185. whitebit/mining_pool/client.py +1083 -0
  186. whitebit/mining_pool/raw_client.py +1695 -0
  187. whitebit/mining_pool/types/__init__.py +69 -0
  188. whitebit/mining_pool/types/create_mining_account_response.py +20 -0
  189. whitebit/mining_pool/types/create_mining_account_response_data.py +31 -0
  190. whitebit/mining_pool/types/create_mining_watcher_link_request_live_until.py +5 -0
  191. whitebit/mining_pool/types/create_mining_watcher_link_request_permissions_item.py +7 -0
  192. whitebit/mining_pool/types/create_mining_watcher_link_response.py +20 -0
  193. whitebit/mining_pool/types/create_mining_watcher_link_response_data.py +24 -0
  194. whitebit/mining_pool/types/get_mining_accounts_response.py +20 -0
  195. whitebit/mining_pool/types/get_mining_accounts_response_data_item.py +31 -0
  196. whitebit/mining_pool/types/get_mining_hashrate_request_interval.py +5 -0
  197. whitebit/mining_pool/types/get_mining_hashrate_response.py +20 -0
  198. whitebit/mining_pool/types/get_mining_hashrate_response_data.py +21 -0
  199. whitebit/mining_pool/types/get_mining_hashrate_response_data_hashrate_item.py +20 -0
  200. whitebit/mining_pool/types/get_mining_miner_info_response.py +20 -0
  201. whitebit/mining_pool/types/get_mining_miner_info_response_data.py +25 -0
  202. whitebit/mining_pool/types/get_mining_miner_info_response_data_stratum_item.py +22 -0
  203. whitebit/mining_pool/types/get_mining_payout_destination_response.py +36 -0
  204. whitebit/mining_pool/types/get_mining_payout_destination_response_payout_destination.py +7 -0
  205. whitebit/mining_pool/types/get_mining_rewards_response.py +22 -0
  206. whitebit/mining_pool/types/get_mining_worker_hashrate_request_interval.py +5 -0
  207. whitebit/mining_pool/types/get_mining_worker_hashrate_response.py +20 -0
  208. whitebit/mining_pool/types/get_mining_worker_hashrate_response_data.py +20 -0
  209. whitebit/mining_pool/types/get_mining_worker_hashrate_response_data_hashrates_item.py +23 -0
  210. whitebit/mining_pool/types/get_mining_worker_names_response.py +22 -0
  211. whitebit/mining_pool/types/get_mining_worker_names_response_data.py +19 -0
  212. whitebit/mining_pool/types/list_mining_watcher_links_response.py +20 -0
  213. whitebit/mining_pool/types/list_mining_watcher_links_response_data_item.py +27 -0
  214. whitebit/mining_pool/types/set_mining_payout_destination_request_destination.py +7 -0
  215. whitebit/mining_pool/types/set_mining_payout_destination_response.py +27 -0
  216. whitebit/mining_pool/types/set_mining_payout_destination_response_payout_destination.py +7 -0
  217. whitebit/public_api_v4/__init__.py +37 -0
  218. whitebit/public_api_v4/client.py +1096 -0
  219. whitebit/public_api_v4/raw_client.py +1398 -0
  220. whitebit/public_api_v4/types/__init__.py +37 -0
  221. whitebit/public_api_v4/types/get_api_v4public_funding_history_market_response_item.py +52 -0
  222. whitebit/public_api_v4/types/get_api_v4public_futures_response.py +22 -0
  223. whitebit/public_api_v4/types/get_api_v4public_markets_response_item.py +110 -0
  224. whitebit/public_api_v4/types/get_api_v4public_markets_response_item_type.py +5 -0
  225. whitebit/public_api_v4/types/get_api_v4public_mining_pool_response.py +20 -0
  226. whitebit/public_api_v4/types/get_api_v4public_mining_pool_response_data.py +39 -0
  227. whitebit/public_api_v4/types/get_api_v4public_mining_pool_response_data_blocks_item.py +22 -0
  228. whitebit/public_api_v4/types/get_api_v4public_mining_pool_response_data_last7days_hash_rate_item.py +20 -0
  229. whitebit/public_api_v4/types/get_api_v4public_platform_status_response.py +22 -0
  230. whitebit/public_api_v4/types/get_api_v4public_ticker_response_value.py +56 -0
  231. whitebit/public_api_v4/types/get_api_v4public_time_response.py +22 -0
  232. whitebit/public_api_v4/types/get_api_v4public_trades_market_request_type.py +5 -0
  233. whitebit/public_api_v4/types/get_api_v4public_trades_market_response_item.py +57 -0
  234. whitebit/public_api_v4/types/get_api_v4public_trades_market_response_item_type.py +5 -0
  235. whitebit/raw_client.py +637 -0
  236. whitebit/spot_trading/__init__.py +47 -0
  237. whitebit/spot_trading/client.py +4143 -0
  238. whitebit/spot_trading/raw_client.py +5628 -0
  239. whitebit/spot_trading/types/__init__.py +45 -0
  240. whitebit/spot_trading/types/cancel_all_orders_request_type_item.py +5 -0
  241. whitebit/spot_trading/types/get_executed_order_history_response_value_item.py +62 -0
  242. whitebit/spot_trading/types/get_executed_order_history_response_value_item_side.py +5 -0
  243. whitebit/spot_trading/types/get_kill_switch_status_response_item.py +44 -0
  244. whitebit/spot_trading/types/get_kill_switch_status_response_item_types_item.py +5 -0
  245. whitebit/spot_trading/types/get_order_deals_response.py +33 -0
  246. whitebit/spot_trading/types/get_order_deals_response_records_item.py +80 -0
  247. whitebit/spot_trading/types/get_order_history_response_value_item.py +131 -0
  248. whitebit/spot_trading/types/get_order_history_response_value_item_side.py +5 -0
  249. whitebit/spot_trading/types/limit_order_request_side.py +5 -0
  250. whitebit/spot_trading/types/limit_order_request_stp.py +5 -0
  251. whitebit/spot_trading/types/set_kill_switch_request_types_item.py +5 -0
  252. whitebit/spot_trading/types/set_kill_switch_response.py +44 -0
  253. whitebit/spot_trading/types/set_kill_switch_response_types_item.py +5 -0
  254. whitebit/spot_trading/types/stop_limit_order_request_side.py +5 -0
  255. whitebit/spot_trading/types/stop_limit_order_request_stp.py +5 -0
  256. whitebit/spot_trading/types/stop_market_order_request_side.py +5 -0
  257. whitebit/spot_trading/types/stop_market_order_request_stp.py +5 -0
  258. whitebit/spot_trading/types/trade_account_balance_response_value.py +27 -0
  259. whitebit/sub_account/__init__.py +25 -0
  260. whitebit/sub_account/client.py +892 -0
  261. whitebit/sub_account/raw_client.py +1399 -0
  262. whitebit/sub_account/types/__init__.py +23 -0
  263. whitebit/sub_account/types/create_sub_account_request_permissions.py +29 -0
  264. whitebit/sub_account/types/edit_sub_account_request_permissions.py +29 -0
  265. whitebit/sub_account/types/get_sub_account_balances_response_value_item.py +21 -0
  266. whitebit/sub_account/types/get_sub_account_transfer_history_request_direction.py +5 -0
  267. whitebit/sub_account/types/get_sub_account_transfer_history_response.py +22 -0
  268. whitebit/sub_account/types/list_sub_accounts_response.py +22 -0
  269. whitebit/sub_account/types/sub_account_transfer_request_direction.py +5 -0
  270. whitebit/sub_account/types/sub_account_transfer_response.py +26 -0
  271. whitebit/sub_account_api_keys/__init__.py +19 -0
  272. whitebit/sub_account_api_keys/client.py +754 -0
  273. whitebit/sub_account_api_keys/raw_client.py +1183 -0
  274. whitebit/sub_account_api_keys/types/__init__.py +17 -0
  275. whitebit/sub_account_api_keys/types/create_sub_account_api_key_ip_address_response.py +19 -0
  276. whitebit/sub_account_api_keys/types/delete_sub_account_api_key_ip_address_response.py +19 -0
  277. whitebit/sub_account_api_keys/types/edit_sub_account_api_key_request_urls_item.py +20 -0
  278. whitebit/sub_account_api_keys/types/list_sub_account_api_key_ip_addresses_response.py +19 -0
  279. whitebit/sub_account_api_keys/types/list_sub_account_api_keys_response.py +22 -0
  280. whitebit/transfer/__init__.py +15 -0
  281. whitebit/transfer/client.py +220 -0
  282. whitebit/transfer/raw_client.py +276 -0
  283. whitebit/transfer/types/__init__.py +13 -0
  284. whitebit/transfer/types/transfer_between_balances_request_from.py +5 -0
  285. whitebit/transfer/types/transfer_between_balances_request_method.py +7 -0
  286. whitebit/transfer/types/transfer_between_balances_request_to.py +5 -0
  287. whitebit/types/__init__.py +311 -0
  288. whitebit/types/asset.py +106 -0
  289. whitebit/types/asset_limits.py +33 -0
  290. whitebit/types/asset_limits_deposit_value.py +20 -0
  291. whitebit/types/asset_limits_withdraw_value.py +20 -0
  292. whitebit/types/asset_memo.py +24 -0
  293. whitebit/types/asset_networks.py +36 -0
  294. whitebit/types/asset_providers.py +24 -0
  295. whitebit/types/authorize_request.py +32 -0
  296. whitebit/types/authorize_response.py +29 -0
  297. whitebit/types/authorize_response_result.py +22 -0
  298. whitebit/types/bad_request_error_body.py +20 -0
  299. whitebit/types/balance_margin_request.py +32 -0
  300. whitebit/types/balance_margin_response.py +33 -0
  301. whitebit/types/balance_margin_response_result_value.py +37 -0
  302. whitebit/types/balance_margin_subscribe.py +32 -0
  303. whitebit/types/balance_margin_update.py +33 -0
  304. whitebit/types/balance_margin_update_params_item.py +48 -0
  305. whitebit/types/balance_spot_request.py +32 -0
  306. whitebit/types/balance_spot_response.py +33 -0
  307. whitebit/types/balance_spot_response_result_value.py +27 -0
  308. whitebit/types/balance_spot_subscribe.py +32 -0
  309. whitebit/types/balance_spot_update.py +33 -0
  310. whitebit/types/balance_spot_update_params_item_value.py +27 -0
  311. whitebit/types/base_request.py +22 -0
  312. whitebit/types/base_response.py +24 -0
  313. whitebit/types/book_ticker_subscribe.py +29 -0
  314. whitebit/types/book_ticker_update.py +26 -0
  315. whitebit/types/book_ticker_update_data.py +5 -0
  316. whitebit/types/borrows_events_subscribe.py +32 -0
  317. whitebit/types/borrows_events_update.py +34 -0
  318. whitebit/types/borrows_subscribe.py +32 -0
  319. whitebit/types/borrows_update.py +30 -0
  320. whitebit/types/borrows_update_params.py +25 -0
  321. whitebit/types/borrows_update_params_records_item.py +47 -0
  322. whitebit/types/bulk_limit_order_response.py +7 -0
  323. whitebit/types/bulk_limit_order_response_item.py +22 -0
  324. whitebit/types/bulk_order_item.py +42 -0
  325. whitebit/types/bulk_order_item_side.py +5 -0
  326. whitebit/types/candle.py +5 -0
  327. whitebit/types/candles_request.py +36 -0
  328. whitebit/types/candles_response.py +26 -0
  329. whitebit/types/candles_subscribe.py +34 -0
  330. whitebit/types/candles_update.py +26 -0
  331. whitebit/types/code_history.py +47 -0
  332. whitebit/types/code_info.py +47 -0
  333. whitebit/types/convert_confirm_response.py +33 -0
  334. whitebit/types/convert_estimate_request_direction.py +5 -0
  335. whitebit/types/convert_estimate_response.py +56 -0
  336. whitebit/types/convert_history_response.py +34 -0
  337. whitebit/types/convert_history_response_records_item.py +45 -0
  338. whitebit/types/convert_history_response_records_item_path_item.py +23 -0
  339. whitebit/types/credit_line.py +28 -0
  340. whitebit/types/deals_request.py +35 -0
  341. whitebit/types/deals_response.py +29 -0
  342. whitebit/types/deals_response_result.py +30 -0
  343. whitebit/types/deals_response_result_records_item.py +82 -0
  344. whitebit/types/deals_subscribe.py +32 -0
  345. whitebit/types/deals_update.py +43 -0
  346. whitebit/types/depth_level.py +5 -0
  347. whitebit/types/depth_request.py +35 -0
  348. whitebit/types/depth_response.py +22 -0
  349. whitebit/types/depth_subscribe.py +32 -0
  350. whitebit/types/depth_update.py +31 -0
  351. whitebit/types/depth_update_data.py +40 -0
  352. whitebit/types/error.py +21 -0
  353. whitebit/types/error_inner.py +21 -0
  354. whitebit/types/error_response.py +32 -0
  355. whitebit/types/error_v4.py +25 -0
  356. whitebit/types/executed_order_object.py +133 -0
  357. whitebit/types/executed_order_object_position_side.py +5 -0
  358. whitebit/types/executed_order_object_stp.py +5 -0
  359. whitebit/types/fee_details.py +23 -0
  360. whitebit/types/fee_details_flex.py +21 -0
  361. whitebit/types/fee_info.py +49 -0
  362. whitebit/types/fee_info_deposit.py +63 -0
  363. whitebit/types/fee_info_withdraw.py +63 -0
  364. whitebit/types/fixed_plan.py +79 -0
  365. whitebit/types/flex_investment.py +67 -0
  366. whitebit/types/flex_investment_history.py +64 -0
  367. whitebit/types/flex_plan.py +50 -0
  368. whitebit/types/futures_market.py +117 -0
  369. whitebit/types/interest_payment.py +48 -0
  370. whitebit/types/investment.py +64 -0
  371. whitebit/types/lastprice_request.py +29 -0
  372. whitebit/types/lastprice_response.py +25 -0
  373. whitebit/types/lastprice_subscribe.py +29 -0
  374. whitebit/types/lastprice_update.py +30 -0
  375. whitebit/types/margin_positions_events_subscribe.py +34 -0
  376. whitebit/types/margin_positions_events_update.py +34 -0
  377. whitebit/types/market_order_request.py +51 -0
  378. whitebit/types/market_order_request_side.py +5 -0
  379. whitebit/types/market_order_request_stp.py +5 -0
  380. whitebit/types/market_request.py +34 -0
  381. whitebit/types/market_response.py +22 -0
  382. whitebit/types/market_statistics.py +57 -0
  383. whitebit/types/market_subscribe.py +25 -0
  384. whitebit/types/market_today_request.py +29 -0
  385. whitebit/types/market_today_response.py +22 -0
  386. whitebit/types/market_today_statistics.py +47 -0
  387. whitebit/types/market_today_subscribe.py +25 -0
  388. whitebit/types/market_today_update.py +30 -0
  389. whitebit/types/market_update.py +30 -0
  390. whitebit/types/mining_reward.py +62 -0
  391. whitebit/types/not_found_error_body.py +20 -0
  392. whitebit/types/order_book.py +33 -0
  393. whitebit/types/order_object.py +118 -0
  394. whitebit/types/order_object_position_side.py +5 -0
  395. whitebit/types/order_object_stp.py +5 -0
  396. whitebit/types/order_response.py +123 -0
  397. whitebit/types/orderbook_response.py +37 -0
  398. whitebit/types/orders_executed_request.py +35 -0
  399. whitebit/types/orders_executed_response.py +29 -0
  400. whitebit/types/orders_executed_response_result.py +30 -0
  401. whitebit/types/orders_executed_subscribe.py +34 -0
  402. whitebit/types/orders_executed_update.py +33 -0
  403. whitebit/types/orders_pending_request.py +32 -0
  404. whitebit/types/orders_pending_response.py +29 -0
  405. whitebit/types/orders_pending_response_result.py +35 -0
  406. whitebit/types/orders_pending_subscribe.py +32 -0
  407. whitebit/types/orders_pending_update.py +32 -0
  408. whitebit/types/ping_request.py +25 -0
  409. whitebit/types/ping_response.py +21 -0
  410. whitebit/types/ping_response_result.py +5 -0
  411. whitebit/types/positions_subscribe.py +32 -0
  412. whitebit/types/positions_update.py +30 -0
  413. whitebit/types/positions_update_params.py +25 -0
  414. whitebit/types/positions_update_params_records_item.py +99 -0
  415. whitebit/types/positions_update_params_records_item_liq_stage.py +5 -0
  416. whitebit/types/positions_update_params_records_item_position_side.py +5 -0
  417. whitebit/types/provider_fee_details.py +28 -0
  418. whitebit/types/sub_account.py +63 -0
  419. whitebit/types/sub_account_api_key.py +84 -0
  420. whitebit/types/sub_account_api_key_access_endpoints_item.py +27 -0
  421. whitebit/types/sub_account_api_key_list.py +39 -0
  422. whitebit/types/sub_account_api_key_list_access_endpoints_item.py +20 -0
  423. whitebit/types/sub_account_kyc.py +37 -0
  424. whitebit/types/sub_account_permissions.py +37 -0
  425. whitebit/types/sub_account_transfer.py +53 -0
  426. whitebit/types/subscription_response.py +29 -0
  427. whitebit/types/subscription_response_result.py +22 -0
  428. whitebit/types/time_request.py +25 -0
  429. whitebit/types/time_response.py +23 -0
  430. whitebit/types/trade.py +48 -0
  431. whitebit/types/trade_type.py +5 -0
  432. whitebit/types/trades_request.py +35 -0
  433. whitebit/types/trades_response.py +22 -0
  434. whitebit/types/trades_subscribe.py +28 -0
  435. whitebit/types/trades_update.py +30 -0
  436. whitebit/types/transaction_history.py +108 -0
  437. whitebit/types/transaction_history_confirmations.py +31 -0
  438. whitebit/types/unprocessable_entity_error_body.py +20 -0
  439. whitebit/types/unsubscribe_request.py +32 -0
  440. whitebit/withdraw/__init__.py +11 -0
  441. whitebit/withdraw/client.py +496 -0
  442. whitebit/withdraw/raw_client.py +634 -0
  443. whitebit/withdraw/types/__init__.py +9 -0
  444. whitebit/withdraw/types/create_withdraw_request_beneficiary.py +74 -0
  445. whitebit/withdraw/types/create_withdraw_request_travel_rule.py +52 -0
  446. whitebit/withdraw/types/create_withdraw_request_travel_rule_type.py +5 -0
  447. whitebit_python_sdk-1.1.0.dist-info/METADATA +155 -0
  448. whitebit_python_sdk-1.1.0.dist-info/RECORD +451 -0
  449. whitebit_python_sdk-1.1.0.dist-info/WHEEL +5 -0
  450. whitebit_python_sdk-1.1.0.dist-info/licenses/LICENSE +20 -0
  451. whitebit_python_sdk-1.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1399 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.pydantic_utilities import parse_obj_as
10
+ from ..core.request_options import RequestOptions
11
+ from ..core.serialization import convert_and_respect_annotation_metadata
12
+ from ..errors.bad_request_error import BadRequestError
13
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
14
+ from ..types.sub_account import SubAccount
15
+ from .types.create_sub_account_request_permissions import CreateSubAccountRequestPermissions
16
+ from .types.edit_sub_account_request_permissions import EditSubAccountRequestPermissions
17
+ from .types.get_sub_account_balances_response_value_item import GetSubAccountBalancesResponseValueItem
18
+ from .types.get_sub_account_transfer_history_request_direction import GetSubAccountTransferHistoryRequestDirection
19
+ from .types.get_sub_account_transfer_history_response import GetSubAccountTransferHistoryResponse
20
+ from .types.list_sub_accounts_response import ListSubAccountsResponse
21
+ from .types.sub_account_transfer_request_direction import SubAccountTransferRequestDirection
22
+ from .types.sub_account_transfer_response import SubAccountTransferResponse
23
+
24
+ # this is used as the default value for optional parameters
25
+ OMIT = typing.cast(typing.Any, ...)
26
+
27
+
28
+ class RawSubAccountClient:
29
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
30
+ self._client_wrapper = client_wrapper
31
+
32
+ def create_sub_account(
33
+ self,
34
+ *,
35
+ alias: str,
36
+ permissions: CreateSubAccountRequestPermissions,
37
+ email: typing.Optional[str] = OMIT,
38
+ share_kyc: typing.Optional[bool] = OMIT,
39
+ request_options: typing.Optional[RequestOptions] = None,
40
+ ) -> HttpResponse[SubAccount]:
41
+ """
42
+ The endpoint creates new [sub-account](/glossary#sub-account).
43
+
44
+ <Note>
45
+ The `email` field requirement depends on the `shareKyc` parameter:
46
+ - When `shareKyc` is `false` or not provided: `email` is **required**
47
+ - When `shareKyc` is `true`: `email` is **optional**
48
+ </Note>
49
+
50
+ <Warning>
51
+ Rate limit: 1000 requests/10 sec.
52
+ </Warning>
53
+
54
+ <Note>
55
+ The API does not cache the response.
56
+ </Note>
57
+
58
+ Parameters
59
+ ----------
60
+ alias : str
61
+ Name for sub-account
62
+
63
+ permissions : CreateSubAccountRequestPermissions
64
+
65
+ email : typing.Optional[str]
66
+ Sub-account email (required when shareKyc is false)
67
+
68
+ share_kyc : typing.Optional[bool]
69
+ If KYC shared with main account
70
+
71
+ request_options : typing.Optional[RequestOptions]
72
+ Request-specific configuration.
73
+
74
+ Returns
75
+ -------
76
+ HttpResponse[SubAccount]
77
+ Sub-account created successfully
78
+ """
79
+ _response = self._client_wrapper.httpx_client.request(
80
+ "api/v4/sub-account/create",
81
+ base_url=self._client_wrapper.get_environment().base,
82
+ method="POST",
83
+ json={
84
+ "alias": alias,
85
+ "email": email,
86
+ "shareKyc": share_kyc,
87
+ "permissions": convert_and_respect_annotation_metadata(
88
+ object_=permissions, annotation=CreateSubAccountRequestPermissions, direction="write"
89
+ ),
90
+ },
91
+ headers={
92
+ "content-type": "application/json",
93
+ },
94
+ request_options=request_options,
95
+ omit=OMIT,
96
+ )
97
+ try:
98
+ if 200 <= _response.status_code < 300:
99
+ _data = typing.cast(
100
+ SubAccount,
101
+ parse_obj_as(
102
+ type_=SubAccount, # type: ignore
103
+ object_=_response.json(),
104
+ ),
105
+ )
106
+ return HttpResponse(response=_response, data=_data)
107
+ if _response.status_code == 400:
108
+ raise BadRequestError(
109
+ headers=dict(_response.headers),
110
+ body=typing.cast(
111
+ typing.Optional[typing.Any],
112
+ parse_obj_as(
113
+ type_=typing.Optional[typing.Any], # type: ignore
114
+ object_=_response.json(),
115
+ ),
116
+ ),
117
+ )
118
+ _response_json = _response.json()
119
+ except JSONDecodeError:
120
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
121
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
122
+
123
+ def delete_sub_account(
124
+ self, *, id: str, request_options: typing.Optional[RequestOptions] = None
125
+ ) -> HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
126
+ """
127
+ The endpoint deletes [sub-account](/glossary#sub-account).
128
+
129
+ <Warning>
130
+ Rate limit: 1000 requests/10 sec.
131
+ </Warning>
132
+
133
+ <Note>
134
+ The API does not cache the response.
135
+ </Note>
136
+
137
+ Parameters
138
+ ----------
139
+ id : str
140
+ Sub-account id
141
+
142
+ request_options : typing.Optional[RequestOptions]
143
+ Request-specific configuration.
144
+
145
+ Returns
146
+ -------
147
+ HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
148
+ Sub-account deleted successfully
149
+ """
150
+ _response = self._client_wrapper.httpx_client.request(
151
+ "api/v4/sub-account/delete",
152
+ base_url=self._client_wrapper.get_environment().base,
153
+ method="POST",
154
+ json={
155
+ "id": id,
156
+ },
157
+ headers={
158
+ "content-type": "application/json",
159
+ },
160
+ request_options=request_options,
161
+ omit=OMIT,
162
+ )
163
+ try:
164
+ if 200 <= _response.status_code < 300:
165
+ _data = typing.cast(
166
+ typing.Dict[str, typing.Optional[typing.Any]],
167
+ parse_obj_as(
168
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
169
+ object_=_response.json(),
170
+ ),
171
+ )
172
+ return HttpResponse(response=_response, data=_data)
173
+ if _response.status_code == 400:
174
+ raise BadRequestError(
175
+ headers=dict(_response.headers),
176
+ body=typing.cast(
177
+ typing.Optional[typing.Any],
178
+ parse_obj_as(
179
+ type_=typing.Optional[typing.Any], # type: ignore
180
+ object_=_response.json(),
181
+ ),
182
+ ),
183
+ )
184
+ _response_json = _response.json()
185
+ except JSONDecodeError:
186
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
187
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
188
+
189
+ def edit_sub_account(
190
+ self,
191
+ *,
192
+ id: str,
193
+ alias: str,
194
+ permissions: EditSubAccountRequestPermissions,
195
+ request_options: typing.Optional[RequestOptions] = None,
196
+ ) -> HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
197
+ """
198
+ The endpoint edits [sub-account](/glossary#sub-account).
199
+
200
+ <Warning>
201
+ Rate limit: 1000 requests/10 sec.
202
+ </Warning>
203
+
204
+ <Note>
205
+ The API does not cache the response.
206
+ </Note>
207
+
208
+ Parameters
209
+ ----------
210
+ id : str
211
+ Sub-account id
212
+
213
+ alias : str
214
+ Name for sub-account
215
+
216
+ permissions : EditSubAccountRequestPermissions
217
+
218
+ request_options : typing.Optional[RequestOptions]
219
+ Request-specific configuration.
220
+
221
+ Returns
222
+ -------
223
+ HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
224
+ Sub-account edited successfully
225
+ """
226
+ _response = self._client_wrapper.httpx_client.request(
227
+ "api/v4/sub-account/edit",
228
+ base_url=self._client_wrapper.get_environment().base,
229
+ method="POST",
230
+ json={
231
+ "id": id,
232
+ "alias": alias,
233
+ "permissions": convert_and_respect_annotation_metadata(
234
+ object_=permissions, annotation=EditSubAccountRequestPermissions, direction="write"
235
+ ),
236
+ },
237
+ headers={
238
+ "content-type": "application/json",
239
+ },
240
+ request_options=request_options,
241
+ omit=OMIT,
242
+ )
243
+ try:
244
+ if 200 <= _response.status_code < 300:
245
+ _data = typing.cast(
246
+ typing.Dict[str, typing.Optional[typing.Any]],
247
+ parse_obj_as(
248
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
249
+ object_=_response.json(),
250
+ ),
251
+ )
252
+ return HttpResponse(response=_response, data=_data)
253
+ if _response.status_code == 400:
254
+ raise BadRequestError(
255
+ headers=dict(_response.headers),
256
+ body=typing.cast(
257
+ typing.Optional[typing.Any],
258
+ parse_obj_as(
259
+ type_=typing.Optional[typing.Any], # type: ignore
260
+ object_=_response.json(),
261
+ ),
262
+ ),
263
+ )
264
+ _response_json = _response.json()
265
+ except JSONDecodeError:
266
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
267
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
268
+
269
+ def list_sub_accounts(
270
+ self,
271
+ *,
272
+ search: typing.Optional[str] = OMIT,
273
+ limit: typing.Optional[int] = OMIT,
274
+ offset: typing.Optional[int] = OMIT,
275
+ request_options: typing.Optional[RequestOptions] = None,
276
+ ) -> HttpResponse[ListSubAccountsResponse]:
277
+ """
278
+ The endpoint returns list of current user [sub-accounts](/glossary#sub-account).
279
+
280
+ <Warning>
281
+ Rate limit: 1000 requests/10 sec.
282
+ </Warning>
283
+
284
+ <Note>
285
+ The API does not cache the response.
286
+ </Note>
287
+
288
+ Parameters
289
+ ----------
290
+ search : typing.Optional[str]
291
+ Search term
292
+
293
+ limit : typing.Optional[int]
294
+
295
+ offset : typing.Optional[int]
296
+
297
+ request_options : typing.Optional[RequestOptions]
298
+ Request-specific configuration.
299
+
300
+ Returns
301
+ -------
302
+ HttpResponse[ListSubAccountsResponse]
303
+ Successful response
304
+ """
305
+ _response = self._client_wrapper.httpx_client.request(
306
+ "api/v4/sub-account/list",
307
+ base_url=self._client_wrapper.get_environment().base,
308
+ method="POST",
309
+ json={
310
+ "search": search,
311
+ "limit": limit,
312
+ "offset": offset,
313
+ },
314
+ headers={
315
+ "content-type": "application/json",
316
+ },
317
+ request_options=request_options,
318
+ omit=OMIT,
319
+ )
320
+ try:
321
+ if 200 <= _response.status_code < 300:
322
+ _data = typing.cast(
323
+ ListSubAccountsResponse,
324
+ parse_obj_as(
325
+ type_=ListSubAccountsResponse, # type: ignore
326
+ object_=_response.json(),
327
+ ),
328
+ )
329
+ return HttpResponse(response=_response, data=_data)
330
+ if _response.status_code == 400:
331
+ raise BadRequestError(
332
+ headers=dict(_response.headers),
333
+ body=typing.cast(
334
+ typing.Optional[typing.Any],
335
+ parse_obj_as(
336
+ type_=typing.Optional[typing.Any], # type: ignore
337
+ object_=_response.json(),
338
+ ),
339
+ ),
340
+ )
341
+ _response_json = _response.json()
342
+ except JSONDecodeError:
343
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
344
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
345
+
346
+ def transfer(
347
+ self,
348
+ *,
349
+ id: str,
350
+ direction: SubAccountTransferRequestDirection,
351
+ amount: str,
352
+ ticker: str,
353
+ request_options: typing.Optional[RequestOptions] = None,
354
+ ) -> HttpResponse[SubAccountTransferResponse]:
355
+ """
356
+ The endpoint creates transfer from main account to [sub-account](/glossary#sub-account) or vice versa.
357
+
358
+ <Warning>
359
+ Rate limit: 1000 requests/10 sec.
360
+ </Warning>
361
+
362
+ <Note>
363
+ The API does not cache the response.
364
+ </Note>
365
+
366
+ Parameters
367
+ ----------
368
+ id : str
369
+ Sub-account id
370
+
371
+ direction : SubAccountTransferRequestDirection
372
+ Transfer direction
373
+
374
+ amount : str
375
+ Transfer amount (min 0.00000001)
376
+
377
+ ticker : str
378
+ Currency's [ticker](/glossary#ticker)
379
+
380
+ request_options : typing.Optional[RequestOptions]
381
+ Request-specific configuration.
382
+
383
+ Returns
384
+ -------
385
+ HttpResponse[SubAccountTransferResponse]
386
+ Transfer successful
387
+ """
388
+ _response = self._client_wrapper.httpx_client.request(
389
+ "api/v4/sub-account/transfer",
390
+ base_url=self._client_wrapper.get_environment().base,
391
+ method="POST",
392
+ json={
393
+ "id": id,
394
+ "direction": direction,
395
+ "amount": amount,
396
+ "ticker": ticker,
397
+ },
398
+ headers={
399
+ "content-type": "application/json",
400
+ },
401
+ request_options=request_options,
402
+ omit=OMIT,
403
+ )
404
+ try:
405
+ if 200 <= _response.status_code < 300:
406
+ _data = typing.cast(
407
+ SubAccountTransferResponse,
408
+ parse_obj_as(
409
+ type_=SubAccountTransferResponse, # type: ignore
410
+ object_=_response.json(),
411
+ ),
412
+ )
413
+ return HttpResponse(response=_response, data=_data)
414
+ if _response.status_code == 400:
415
+ raise BadRequestError(
416
+ headers=dict(_response.headers),
417
+ body=typing.cast(
418
+ typing.Optional[typing.Any],
419
+ parse_obj_as(
420
+ type_=typing.Optional[typing.Any], # type: ignore
421
+ object_=_response.json(),
422
+ ),
423
+ ),
424
+ )
425
+ _response_json = _response.json()
426
+ except JSONDecodeError:
427
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
428
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
429
+
430
+ def block_sub_account(
431
+ self, *, id: str, request_options: typing.Optional[RequestOptions] = None
432
+ ) -> HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
433
+ """
434
+ The endpoint blocks [sub-account](/glossary#sub-account).
435
+
436
+ <Warning>
437
+ Rate limit: 1000 requests/10 sec.
438
+ </Warning>
439
+
440
+ <Note>
441
+ The API does not cache the response.
442
+ </Note>
443
+
444
+ Parameters
445
+ ----------
446
+ id : str
447
+ Sub-account id
448
+
449
+ request_options : typing.Optional[RequestOptions]
450
+ Request-specific configuration.
451
+
452
+ Returns
453
+ -------
454
+ HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
455
+ Sub-account blocked successfully
456
+ """
457
+ _response = self._client_wrapper.httpx_client.request(
458
+ "api/v4/sub-account/block",
459
+ base_url=self._client_wrapper.get_environment().base,
460
+ method="POST",
461
+ json={
462
+ "id": id,
463
+ },
464
+ headers={
465
+ "content-type": "application/json",
466
+ },
467
+ request_options=request_options,
468
+ omit=OMIT,
469
+ )
470
+ try:
471
+ if 200 <= _response.status_code < 300:
472
+ _data = typing.cast(
473
+ typing.Dict[str, typing.Optional[typing.Any]],
474
+ parse_obj_as(
475
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
476
+ object_=_response.json(),
477
+ ),
478
+ )
479
+ return HttpResponse(response=_response, data=_data)
480
+ if _response.status_code == 400:
481
+ raise BadRequestError(
482
+ headers=dict(_response.headers),
483
+ body=typing.cast(
484
+ typing.Optional[typing.Any],
485
+ parse_obj_as(
486
+ type_=typing.Optional[typing.Any], # type: ignore
487
+ object_=_response.json(),
488
+ ),
489
+ ),
490
+ )
491
+ _response_json = _response.json()
492
+ except JSONDecodeError:
493
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
494
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
495
+
496
+ def unblock_sub_account(
497
+ self, *, id: str, request_options: typing.Optional[RequestOptions] = None
498
+ ) -> HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
499
+ """
500
+ The endpoint unblocks [sub-account](/glossary#sub-account).
501
+
502
+ <Warning>
503
+ Rate limit: 1000 requests/10 sec.
504
+ </Warning>
505
+
506
+ <Note>
507
+ The API does not cache the response.
508
+ </Note>
509
+
510
+ Parameters
511
+ ----------
512
+ id : str
513
+ Sub-account id
514
+
515
+ request_options : typing.Optional[RequestOptions]
516
+ Request-specific configuration.
517
+
518
+ Returns
519
+ -------
520
+ HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
521
+ Sub-account unblocked successfully
522
+ """
523
+ _response = self._client_wrapper.httpx_client.request(
524
+ "api/v4/sub-account/unblock",
525
+ base_url=self._client_wrapper.get_environment().base,
526
+ method="POST",
527
+ json={
528
+ "id": id,
529
+ },
530
+ headers={
531
+ "content-type": "application/json",
532
+ },
533
+ request_options=request_options,
534
+ omit=OMIT,
535
+ )
536
+ try:
537
+ if 200 <= _response.status_code < 300:
538
+ _data = typing.cast(
539
+ typing.Dict[str, typing.Optional[typing.Any]],
540
+ parse_obj_as(
541
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
542
+ object_=_response.json(),
543
+ ),
544
+ )
545
+ return HttpResponse(response=_response, data=_data)
546
+ if _response.status_code == 400:
547
+ raise BadRequestError(
548
+ headers=dict(_response.headers),
549
+ body=typing.cast(
550
+ typing.Optional[typing.Any],
551
+ parse_obj_as(
552
+ type_=typing.Optional[typing.Any], # type: ignore
553
+ object_=_response.json(),
554
+ ),
555
+ ),
556
+ )
557
+ _response_json = _response.json()
558
+ except JSONDecodeError:
559
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
560
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
561
+
562
+ def get_sub_account_balances(
563
+ self, *, id: str, ticker: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
564
+ ) -> HttpResponse[typing.Dict[str, typing.List[GetSubAccountBalancesResponseValueItem]]]:
565
+ """
566
+ The endpoint returns [sub-account](/glossary#sub-account) balances.
567
+
568
+ <Warning>
569
+ Rate limit: 1000 requests/10 sec.
570
+ </Warning>
571
+
572
+ <Note>
573
+ The API does not cache the response.
574
+ </Note>
575
+
576
+ Parameters
577
+ ----------
578
+ id : str
579
+ Sub-account id
580
+
581
+ ticker : typing.Optional[str]
582
+ Currency's ticker (if not provided, returns data by all currencies)
583
+
584
+ request_options : typing.Optional[RequestOptions]
585
+ Request-specific configuration.
586
+
587
+ Returns
588
+ -------
589
+ HttpResponse[typing.Dict[str, typing.List[GetSubAccountBalancesResponseValueItem]]]
590
+ Successful response
591
+ """
592
+ _response = self._client_wrapper.httpx_client.request(
593
+ "api/v4/sub-account/balances",
594
+ base_url=self._client_wrapper.get_environment().base,
595
+ method="POST",
596
+ json={
597
+ "id": id,
598
+ "ticker": ticker,
599
+ },
600
+ headers={
601
+ "content-type": "application/json",
602
+ },
603
+ request_options=request_options,
604
+ omit=OMIT,
605
+ )
606
+ try:
607
+ if 200 <= _response.status_code < 300:
608
+ _data = typing.cast(
609
+ typing.Dict[str, typing.List[GetSubAccountBalancesResponseValueItem]],
610
+ parse_obj_as(
611
+ type_=typing.Dict[str, typing.List[GetSubAccountBalancesResponseValueItem]], # type: ignore
612
+ object_=_response.json(),
613
+ ),
614
+ )
615
+ return HttpResponse(response=_response, data=_data)
616
+ if _response.status_code == 422:
617
+ raise UnprocessableEntityError(
618
+ headers=dict(_response.headers),
619
+ body=typing.cast(
620
+ typing.Optional[typing.Any],
621
+ parse_obj_as(
622
+ type_=typing.Optional[typing.Any], # type: ignore
623
+ object_=_response.json(),
624
+ ),
625
+ ),
626
+ )
627
+ _response_json = _response.json()
628
+ except JSONDecodeError:
629
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
630
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
631
+
632
+ def get_sub_account_transfer_history(
633
+ self,
634
+ *,
635
+ id: str,
636
+ direction: typing.Optional[GetSubAccountTransferHistoryRequestDirection] = OMIT,
637
+ limit: typing.Optional[int] = OMIT,
638
+ offset: typing.Optional[int] = OMIT,
639
+ request_options: typing.Optional[RequestOptions] = None,
640
+ ) -> HttpResponse[GetSubAccountTransferHistoryResponse]:
641
+ """
642
+ The endpoint returns history of transfers between main account and [sub-account](/glossary#sub-account).
643
+
644
+ <Warning>
645
+ Rate limit: 1000 requests/10 sec.
646
+ </Warning>
647
+
648
+ <Note>
649
+ The API does not cache the response.
650
+ </Note>
651
+
652
+ Parameters
653
+ ----------
654
+ id : str
655
+ Sub-account id
656
+
657
+ direction : typing.Optional[GetSubAccountTransferHistoryRequestDirection]
658
+ Transfer direction (optional)
659
+
660
+ limit : typing.Optional[int]
661
+
662
+ offset : typing.Optional[int]
663
+
664
+ request_options : typing.Optional[RequestOptions]
665
+ Request-specific configuration.
666
+
667
+ Returns
668
+ -------
669
+ HttpResponse[GetSubAccountTransferHistoryResponse]
670
+ Successful response
671
+ """
672
+ _response = self._client_wrapper.httpx_client.request(
673
+ "api/v4/sub-account/transfer/history",
674
+ base_url=self._client_wrapper.get_environment().base,
675
+ method="POST",
676
+ json={
677
+ "id": id,
678
+ "direction": direction,
679
+ "limit": limit,
680
+ "offset": offset,
681
+ },
682
+ headers={
683
+ "content-type": "application/json",
684
+ },
685
+ request_options=request_options,
686
+ omit=OMIT,
687
+ )
688
+ try:
689
+ if 200 <= _response.status_code < 300:
690
+ _data = typing.cast(
691
+ GetSubAccountTransferHistoryResponse,
692
+ parse_obj_as(
693
+ type_=GetSubAccountTransferHistoryResponse, # type: ignore
694
+ object_=_response.json(),
695
+ ),
696
+ )
697
+ return HttpResponse(response=_response, data=_data)
698
+ if _response.status_code == 422:
699
+ raise UnprocessableEntityError(
700
+ headers=dict(_response.headers),
701
+ body=typing.cast(
702
+ typing.Optional[typing.Any],
703
+ parse_obj_as(
704
+ type_=typing.Optional[typing.Any], # type: ignore
705
+ object_=_response.json(),
706
+ ),
707
+ ),
708
+ )
709
+ _response_json = _response.json()
710
+ except JSONDecodeError:
711
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
712
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
713
+
714
+
715
+ class AsyncRawSubAccountClient:
716
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
717
+ self._client_wrapper = client_wrapper
718
+
719
+ async def create_sub_account(
720
+ self,
721
+ *,
722
+ alias: str,
723
+ permissions: CreateSubAccountRequestPermissions,
724
+ email: typing.Optional[str] = OMIT,
725
+ share_kyc: typing.Optional[bool] = OMIT,
726
+ request_options: typing.Optional[RequestOptions] = None,
727
+ ) -> AsyncHttpResponse[SubAccount]:
728
+ """
729
+ The endpoint creates new [sub-account](/glossary#sub-account).
730
+
731
+ <Note>
732
+ The `email` field requirement depends on the `shareKyc` parameter:
733
+ - When `shareKyc` is `false` or not provided: `email` is **required**
734
+ - When `shareKyc` is `true`: `email` is **optional**
735
+ </Note>
736
+
737
+ <Warning>
738
+ Rate limit: 1000 requests/10 sec.
739
+ </Warning>
740
+
741
+ <Note>
742
+ The API does not cache the response.
743
+ </Note>
744
+
745
+ Parameters
746
+ ----------
747
+ alias : str
748
+ Name for sub-account
749
+
750
+ permissions : CreateSubAccountRequestPermissions
751
+
752
+ email : typing.Optional[str]
753
+ Sub-account email (required when shareKyc is false)
754
+
755
+ share_kyc : typing.Optional[bool]
756
+ If KYC shared with main account
757
+
758
+ request_options : typing.Optional[RequestOptions]
759
+ Request-specific configuration.
760
+
761
+ Returns
762
+ -------
763
+ AsyncHttpResponse[SubAccount]
764
+ Sub-account created successfully
765
+ """
766
+ _response = await self._client_wrapper.httpx_client.request(
767
+ "api/v4/sub-account/create",
768
+ base_url=self._client_wrapper.get_environment().base,
769
+ method="POST",
770
+ json={
771
+ "alias": alias,
772
+ "email": email,
773
+ "shareKyc": share_kyc,
774
+ "permissions": convert_and_respect_annotation_metadata(
775
+ object_=permissions, annotation=CreateSubAccountRequestPermissions, direction="write"
776
+ ),
777
+ },
778
+ headers={
779
+ "content-type": "application/json",
780
+ },
781
+ request_options=request_options,
782
+ omit=OMIT,
783
+ )
784
+ try:
785
+ if 200 <= _response.status_code < 300:
786
+ _data = typing.cast(
787
+ SubAccount,
788
+ parse_obj_as(
789
+ type_=SubAccount, # type: ignore
790
+ object_=_response.json(),
791
+ ),
792
+ )
793
+ return AsyncHttpResponse(response=_response, data=_data)
794
+ if _response.status_code == 400:
795
+ raise BadRequestError(
796
+ headers=dict(_response.headers),
797
+ body=typing.cast(
798
+ typing.Optional[typing.Any],
799
+ parse_obj_as(
800
+ type_=typing.Optional[typing.Any], # type: ignore
801
+ object_=_response.json(),
802
+ ),
803
+ ),
804
+ )
805
+ _response_json = _response.json()
806
+ except JSONDecodeError:
807
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
808
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
809
+
810
+ async def delete_sub_account(
811
+ self, *, id: str, request_options: typing.Optional[RequestOptions] = None
812
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
813
+ """
814
+ The endpoint deletes [sub-account](/glossary#sub-account).
815
+
816
+ <Warning>
817
+ Rate limit: 1000 requests/10 sec.
818
+ </Warning>
819
+
820
+ <Note>
821
+ The API does not cache the response.
822
+ </Note>
823
+
824
+ Parameters
825
+ ----------
826
+ id : str
827
+ Sub-account id
828
+
829
+ request_options : typing.Optional[RequestOptions]
830
+ Request-specific configuration.
831
+
832
+ Returns
833
+ -------
834
+ AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
835
+ Sub-account deleted successfully
836
+ """
837
+ _response = await self._client_wrapper.httpx_client.request(
838
+ "api/v4/sub-account/delete",
839
+ base_url=self._client_wrapper.get_environment().base,
840
+ method="POST",
841
+ json={
842
+ "id": id,
843
+ },
844
+ headers={
845
+ "content-type": "application/json",
846
+ },
847
+ request_options=request_options,
848
+ omit=OMIT,
849
+ )
850
+ try:
851
+ if 200 <= _response.status_code < 300:
852
+ _data = typing.cast(
853
+ typing.Dict[str, typing.Optional[typing.Any]],
854
+ parse_obj_as(
855
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
856
+ object_=_response.json(),
857
+ ),
858
+ )
859
+ return AsyncHttpResponse(response=_response, data=_data)
860
+ if _response.status_code == 400:
861
+ raise BadRequestError(
862
+ headers=dict(_response.headers),
863
+ body=typing.cast(
864
+ typing.Optional[typing.Any],
865
+ parse_obj_as(
866
+ type_=typing.Optional[typing.Any], # type: ignore
867
+ object_=_response.json(),
868
+ ),
869
+ ),
870
+ )
871
+ _response_json = _response.json()
872
+ except JSONDecodeError:
873
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
874
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
875
+
876
+ async def edit_sub_account(
877
+ self,
878
+ *,
879
+ id: str,
880
+ alias: str,
881
+ permissions: EditSubAccountRequestPermissions,
882
+ request_options: typing.Optional[RequestOptions] = None,
883
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
884
+ """
885
+ The endpoint edits [sub-account](/glossary#sub-account).
886
+
887
+ <Warning>
888
+ Rate limit: 1000 requests/10 sec.
889
+ </Warning>
890
+
891
+ <Note>
892
+ The API does not cache the response.
893
+ </Note>
894
+
895
+ Parameters
896
+ ----------
897
+ id : str
898
+ Sub-account id
899
+
900
+ alias : str
901
+ Name for sub-account
902
+
903
+ permissions : EditSubAccountRequestPermissions
904
+
905
+ request_options : typing.Optional[RequestOptions]
906
+ Request-specific configuration.
907
+
908
+ Returns
909
+ -------
910
+ AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
911
+ Sub-account edited successfully
912
+ """
913
+ _response = await self._client_wrapper.httpx_client.request(
914
+ "api/v4/sub-account/edit",
915
+ base_url=self._client_wrapper.get_environment().base,
916
+ method="POST",
917
+ json={
918
+ "id": id,
919
+ "alias": alias,
920
+ "permissions": convert_and_respect_annotation_metadata(
921
+ object_=permissions, annotation=EditSubAccountRequestPermissions, direction="write"
922
+ ),
923
+ },
924
+ headers={
925
+ "content-type": "application/json",
926
+ },
927
+ request_options=request_options,
928
+ omit=OMIT,
929
+ )
930
+ try:
931
+ if 200 <= _response.status_code < 300:
932
+ _data = typing.cast(
933
+ typing.Dict[str, typing.Optional[typing.Any]],
934
+ parse_obj_as(
935
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
936
+ object_=_response.json(),
937
+ ),
938
+ )
939
+ return AsyncHttpResponse(response=_response, data=_data)
940
+ if _response.status_code == 400:
941
+ raise BadRequestError(
942
+ headers=dict(_response.headers),
943
+ body=typing.cast(
944
+ typing.Optional[typing.Any],
945
+ parse_obj_as(
946
+ type_=typing.Optional[typing.Any], # type: ignore
947
+ object_=_response.json(),
948
+ ),
949
+ ),
950
+ )
951
+ _response_json = _response.json()
952
+ except JSONDecodeError:
953
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
954
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
955
+
956
+ async def list_sub_accounts(
957
+ self,
958
+ *,
959
+ search: typing.Optional[str] = OMIT,
960
+ limit: typing.Optional[int] = OMIT,
961
+ offset: typing.Optional[int] = OMIT,
962
+ request_options: typing.Optional[RequestOptions] = None,
963
+ ) -> AsyncHttpResponse[ListSubAccountsResponse]:
964
+ """
965
+ The endpoint returns list of current user [sub-accounts](/glossary#sub-account).
966
+
967
+ <Warning>
968
+ Rate limit: 1000 requests/10 sec.
969
+ </Warning>
970
+
971
+ <Note>
972
+ The API does not cache the response.
973
+ </Note>
974
+
975
+ Parameters
976
+ ----------
977
+ search : typing.Optional[str]
978
+ Search term
979
+
980
+ limit : typing.Optional[int]
981
+
982
+ offset : typing.Optional[int]
983
+
984
+ request_options : typing.Optional[RequestOptions]
985
+ Request-specific configuration.
986
+
987
+ Returns
988
+ -------
989
+ AsyncHttpResponse[ListSubAccountsResponse]
990
+ Successful response
991
+ """
992
+ _response = await self._client_wrapper.httpx_client.request(
993
+ "api/v4/sub-account/list",
994
+ base_url=self._client_wrapper.get_environment().base,
995
+ method="POST",
996
+ json={
997
+ "search": search,
998
+ "limit": limit,
999
+ "offset": offset,
1000
+ },
1001
+ headers={
1002
+ "content-type": "application/json",
1003
+ },
1004
+ request_options=request_options,
1005
+ omit=OMIT,
1006
+ )
1007
+ try:
1008
+ if 200 <= _response.status_code < 300:
1009
+ _data = typing.cast(
1010
+ ListSubAccountsResponse,
1011
+ parse_obj_as(
1012
+ type_=ListSubAccountsResponse, # type: ignore
1013
+ object_=_response.json(),
1014
+ ),
1015
+ )
1016
+ return AsyncHttpResponse(response=_response, data=_data)
1017
+ if _response.status_code == 400:
1018
+ raise BadRequestError(
1019
+ headers=dict(_response.headers),
1020
+ body=typing.cast(
1021
+ typing.Optional[typing.Any],
1022
+ parse_obj_as(
1023
+ type_=typing.Optional[typing.Any], # type: ignore
1024
+ object_=_response.json(),
1025
+ ),
1026
+ ),
1027
+ )
1028
+ _response_json = _response.json()
1029
+ except JSONDecodeError:
1030
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1031
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1032
+
1033
+ async def transfer(
1034
+ self,
1035
+ *,
1036
+ id: str,
1037
+ direction: SubAccountTransferRequestDirection,
1038
+ amount: str,
1039
+ ticker: str,
1040
+ request_options: typing.Optional[RequestOptions] = None,
1041
+ ) -> AsyncHttpResponse[SubAccountTransferResponse]:
1042
+ """
1043
+ The endpoint creates transfer from main account to [sub-account](/glossary#sub-account) or vice versa.
1044
+
1045
+ <Warning>
1046
+ Rate limit: 1000 requests/10 sec.
1047
+ </Warning>
1048
+
1049
+ <Note>
1050
+ The API does not cache the response.
1051
+ </Note>
1052
+
1053
+ Parameters
1054
+ ----------
1055
+ id : str
1056
+ Sub-account id
1057
+
1058
+ direction : SubAccountTransferRequestDirection
1059
+ Transfer direction
1060
+
1061
+ amount : str
1062
+ Transfer amount (min 0.00000001)
1063
+
1064
+ ticker : str
1065
+ Currency's [ticker](/glossary#ticker)
1066
+
1067
+ request_options : typing.Optional[RequestOptions]
1068
+ Request-specific configuration.
1069
+
1070
+ Returns
1071
+ -------
1072
+ AsyncHttpResponse[SubAccountTransferResponse]
1073
+ Transfer successful
1074
+ """
1075
+ _response = await self._client_wrapper.httpx_client.request(
1076
+ "api/v4/sub-account/transfer",
1077
+ base_url=self._client_wrapper.get_environment().base,
1078
+ method="POST",
1079
+ json={
1080
+ "id": id,
1081
+ "direction": direction,
1082
+ "amount": amount,
1083
+ "ticker": ticker,
1084
+ },
1085
+ headers={
1086
+ "content-type": "application/json",
1087
+ },
1088
+ request_options=request_options,
1089
+ omit=OMIT,
1090
+ )
1091
+ try:
1092
+ if 200 <= _response.status_code < 300:
1093
+ _data = typing.cast(
1094
+ SubAccountTransferResponse,
1095
+ parse_obj_as(
1096
+ type_=SubAccountTransferResponse, # type: ignore
1097
+ object_=_response.json(),
1098
+ ),
1099
+ )
1100
+ return AsyncHttpResponse(response=_response, data=_data)
1101
+ if _response.status_code == 400:
1102
+ raise BadRequestError(
1103
+ headers=dict(_response.headers),
1104
+ body=typing.cast(
1105
+ typing.Optional[typing.Any],
1106
+ parse_obj_as(
1107
+ type_=typing.Optional[typing.Any], # type: ignore
1108
+ object_=_response.json(),
1109
+ ),
1110
+ ),
1111
+ )
1112
+ _response_json = _response.json()
1113
+ except JSONDecodeError:
1114
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1115
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1116
+
1117
+ async def block_sub_account(
1118
+ self, *, id: str, request_options: typing.Optional[RequestOptions] = None
1119
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
1120
+ """
1121
+ The endpoint blocks [sub-account](/glossary#sub-account).
1122
+
1123
+ <Warning>
1124
+ Rate limit: 1000 requests/10 sec.
1125
+ </Warning>
1126
+
1127
+ <Note>
1128
+ The API does not cache the response.
1129
+ </Note>
1130
+
1131
+ Parameters
1132
+ ----------
1133
+ id : str
1134
+ Sub-account id
1135
+
1136
+ request_options : typing.Optional[RequestOptions]
1137
+ Request-specific configuration.
1138
+
1139
+ Returns
1140
+ -------
1141
+ AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
1142
+ Sub-account blocked successfully
1143
+ """
1144
+ _response = await self._client_wrapper.httpx_client.request(
1145
+ "api/v4/sub-account/block",
1146
+ base_url=self._client_wrapper.get_environment().base,
1147
+ method="POST",
1148
+ json={
1149
+ "id": id,
1150
+ },
1151
+ headers={
1152
+ "content-type": "application/json",
1153
+ },
1154
+ request_options=request_options,
1155
+ omit=OMIT,
1156
+ )
1157
+ try:
1158
+ if 200 <= _response.status_code < 300:
1159
+ _data = typing.cast(
1160
+ typing.Dict[str, typing.Optional[typing.Any]],
1161
+ parse_obj_as(
1162
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
1163
+ object_=_response.json(),
1164
+ ),
1165
+ )
1166
+ return AsyncHttpResponse(response=_response, data=_data)
1167
+ if _response.status_code == 400:
1168
+ raise BadRequestError(
1169
+ headers=dict(_response.headers),
1170
+ body=typing.cast(
1171
+ typing.Optional[typing.Any],
1172
+ parse_obj_as(
1173
+ type_=typing.Optional[typing.Any], # type: ignore
1174
+ object_=_response.json(),
1175
+ ),
1176
+ ),
1177
+ )
1178
+ _response_json = _response.json()
1179
+ except JSONDecodeError:
1180
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1181
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1182
+
1183
+ async def unblock_sub_account(
1184
+ self, *, id: str, request_options: typing.Optional[RequestOptions] = None
1185
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
1186
+ """
1187
+ The endpoint unblocks [sub-account](/glossary#sub-account).
1188
+
1189
+ <Warning>
1190
+ Rate limit: 1000 requests/10 sec.
1191
+ </Warning>
1192
+
1193
+ <Note>
1194
+ The API does not cache the response.
1195
+ </Note>
1196
+
1197
+ Parameters
1198
+ ----------
1199
+ id : str
1200
+ Sub-account id
1201
+
1202
+ request_options : typing.Optional[RequestOptions]
1203
+ Request-specific configuration.
1204
+
1205
+ Returns
1206
+ -------
1207
+ AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
1208
+ Sub-account unblocked successfully
1209
+ """
1210
+ _response = await self._client_wrapper.httpx_client.request(
1211
+ "api/v4/sub-account/unblock",
1212
+ base_url=self._client_wrapper.get_environment().base,
1213
+ method="POST",
1214
+ json={
1215
+ "id": id,
1216
+ },
1217
+ headers={
1218
+ "content-type": "application/json",
1219
+ },
1220
+ request_options=request_options,
1221
+ omit=OMIT,
1222
+ )
1223
+ try:
1224
+ if 200 <= _response.status_code < 300:
1225
+ _data = typing.cast(
1226
+ typing.Dict[str, typing.Optional[typing.Any]],
1227
+ parse_obj_as(
1228
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
1229
+ object_=_response.json(),
1230
+ ),
1231
+ )
1232
+ return AsyncHttpResponse(response=_response, data=_data)
1233
+ if _response.status_code == 400:
1234
+ raise BadRequestError(
1235
+ headers=dict(_response.headers),
1236
+ body=typing.cast(
1237
+ typing.Optional[typing.Any],
1238
+ parse_obj_as(
1239
+ type_=typing.Optional[typing.Any], # type: ignore
1240
+ object_=_response.json(),
1241
+ ),
1242
+ ),
1243
+ )
1244
+ _response_json = _response.json()
1245
+ except JSONDecodeError:
1246
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1247
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1248
+
1249
+ async def get_sub_account_balances(
1250
+ self, *, id: str, ticker: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
1251
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.List[GetSubAccountBalancesResponseValueItem]]]:
1252
+ """
1253
+ The endpoint returns [sub-account](/glossary#sub-account) balances.
1254
+
1255
+ <Warning>
1256
+ Rate limit: 1000 requests/10 sec.
1257
+ </Warning>
1258
+
1259
+ <Note>
1260
+ The API does not cache the response.
1261
+ </Note>
1262
+
1263
+ Parameters
1264
+ ----------
1265
+ id : str
1266
+ Sub-account id
1267
+
1268
+ ticker : typing.Optional[str]
1269
+ Currency's ticker (if not provided, returns data by all currencies)
1270
+
1271
+ request_options : typing.Optional[RequestOptions]
1272
+ Request-specific configuration.
1273
+
1274
+ Returns
1275
+ -------
1276
+ AsyncHttpResponse[typing.Dict[str, typing.List[GetSubAccountBalancesResponseValueItem]]]
1277
+ Successful response
1278
+ """
1279
+ _response = await self._client_wrapper.httpx_client.request(
1280
+ "api/v4/sub-account/balances",
1281
+ base_url=self._client_wrapper.get_environment().base,
1282
+ method="POST",
1283
+ json={
1284
+ "id": id,
1285
+ "ticker": ticker,
1286
+ },
1287
+ headers={
1288
+ "content-type": "application/json",
1289
+ },
1290
+ request_options=request_options,
1291
+ omit=OMIT,
1292
+ )
1293
+ try:
1294
+ if 200 <= _response.status_code < 300:
1295
+ _data = typing.cast(
1296
+ typing.Dict[str, typing.List[GetSubAccountBalancesResponseValueItem]],
1297
+ parse_obj_as(
1298
+ type_=typing.Dict[str, typing.List[GetSubAccountBalancesResponseValueItem]], # type: ignore
1299
+ object_=_response.json(),
1300
+ ),
1301
+ )
1302
+ return AsyncHttpResponse(response=_response, data=_data)
1303
+ if _response.status_code == 422:
1304
+ raise UnprocessableEntityError(
1305
+ headers=dict(_response.headers),
1306
+ body=typing.cast(
1307
+ typing.Optional[typing.Any],
1308
+ parse_obj_as(
1309
+ type_=typing.Optional[typing.Any], # type: ignore
1310
+ object_=_response.json(),
1311
+ ),
1312
+ ),
1313
+ )
1314
+ _response_json = _response.json()
1315
+ except JSONDecodeError:
1316
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1317
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1318
+
1319
+ async def get_sub_account_transfer_history(
1320
+ self,
1321
+ *,
1322
+ id: str,
1323
+ direction: typing.Optional[GetSubAccountTransferHistoryRequestDirection] = OMIT,
1324
+ limit: typing.Optional[int] = OMIT,
1325
+ offset: typing.Optional[int] = OMIT,
1326
+ request_options: typing.Optional[RequestOptions] = None,
1327
+ ) -> AsyncHttpResponse[GetSubAccountTransferHistoryResponse]:
1328
+ """
1329
+ The endpoint returns history of transfers between main account and [sub-account](/glossary#sub-account).
1330
+
1331
+ <Warning>
1332
+ Rate limit: 1000 requests/10 sec.
1333
+ </Warning>
1334
+
1335
+ <Note>
1336
+ The API does not cache the response.
1337
+ </Note>
1338
+
1339
+ Parameters
1340
+ ----------
1341
+ id : str
1342
+ Sub-account id
1343
+
1344
+ direction : typing.Optional[GetSubAccountTransferHistoryRequestDirection]
1345
+ Transfer direction (optional)
1346
+
1347
+ limit : typing.Optional[int]
1348
+
1349
+ offset : typing.Optional[int]
1350
+
1351
+ request_options : typing.Optional[RequestOptions]
1352
+ Request-specific configuration.
1353
+
1354
+ Returns
1355
+ -------
1356
+ AsyncHttpResponse[GetSubAccountTransferHistoryResponse]
1357
+ Successful response
1358
+ """
1359
+ _response = await self._client_wrapper.httpx_client.request(
1360
+ "api/v4/sub-account/transfer/history",
1361
+ base_url=self._client_wrapper.get_environment().base,
1362
+ method="POST",
1363
+ json={
1364
+ "id": id,
1365
+ "direction": direction,
1366
+ "limit": limit,
1367
+ "offset": offset,
1368
+ },
1369
+ headers={
1370
+ "content-type": "application/json",
1371
+ },
1372
+ request_options=request_options,
1373
+ omit=OMIT,
1374
+ )
1375
+ try:
1376
+ if 200 <= _response.status_code < 300:
1377
+ _data = typing.cast(
1378
+ GetSubAccountTransferHistoryResponse,
1379
+ parse_obj_as(
1380
+ type_=GetSubAccountTransferHistoryResponse, # type: ignore
1381
+ object_=_response.json(),
1382
+ ),
1383
+ )
1384
+ return AsyncHttpResponse(response=_response, data=_data)
1385
+ if _response.status_code == 422:
1386
+ raise UnprocessableEntityError(
1387
+ headers=dict(_response.headers),
1388
+ body=typing.cast(
1389
+ typing.Optional[typing.Any],
1390
+ parse_obj_as(
1391
+ type_=typing.Optional[typing.Any], # type: ignore
1392
+ object_=_response.json(),
1393
+ ),
1394
+ ),
1395
+ )
1396
+ _response_json = _response.json()
1397
+ except JSONDecodeError:
1398
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1399
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)