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,931 @@
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 ..errors.bad_request_error import BadRequestError
12
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
13
+ from ..types.fixed_plan import FixedPlan
14
+ from .types.create_fixed_investment_response import CreateFixedInvestmentResponse
15
+ from .types.get_fixed_investments_history_response import GetFixedInvestmentsHistoryResponse
16
+ from .types.get_interest_payment_history_response import GetInterestPaymentHistoryResponse
17
+
18
+ # this is used as the default value for optional parameters
19
+ OMIT = typing.cast(typing.Any, ...)
20
+
21
+
22
+ class RawCryptoLendingFixedClient:
23
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
24
+ self._client_wrapper = client_wrapper
25
+
26
+ def get_fixed_plans(
27
+ self,
28
+ *,
29
+ request: str,
30
+ nonce: str,
31
+ ticker: typing.Optional[str] = OMIT,
32
+ request_options: typing.Optional[RequestOptions] = None,
33
+ ) -> HttpResponse[typing.List[FixedPlan]]:
34
+ """
35
+ The endpoint retrieves all active [plans](/glossary#crypto-lending).
36
+
37
+ <Note>
38
+ These endpoints are available only for B2B partner services. Fill the institutional services form to get permissions to use these endpoints.
39
+ </Note>
40
+
41
+ **Note:** When target currency is different from source currency, interest amount in target currency will be calculated using `interestRatio` value.
42
+
43
+ **Examples:**
44
+ - When source currency = USDT, target currency = BTC and interest ratio = 40000, interest is received in BTC and equals the USDT interest amount divided by the interest ratio (e.g. 0.000025 BTC per 1 USDT of interest).
45
+ - When source currency equals target currency, interest ratio equals 1.
46
+
47
+ <Warning>
48
+ Rate limit: 1000 requests/10 sec.
49
+ </Warning>
50
+
51
+ <Note>
52
+ The API does not cache the response.
53
+ </Note>
54
+
55
+ Parameters
56
+ ----------
57
+ request : str
58
+ Request signature
59
+
60
+ nonce : str
61
+ Unique request identifier
62
+
63
+ ticker : typing.Optional[str]
64
+ [Invest plan](/glossary#crypto-lending) source currency's [ticker](/glossary#ticker). Example: BTC
65
+
66
+ request_options : typing.Optional[RequestOptions]
67
+ Request-specific configuration.
68
+
69
+ Returns
70
+ -------
71
+ HttpResponse[typing.List[FixedPlan]]
72
+ Successful response
73
+ """
74
+ _response = self._client_wrapper.httpx_client.request(
75
+ "api/v4/main-account/smart/plans",
76
+ base_url=self._client_wrapper.get_environment().base,
77
+ method="POST",
78
+ json={
79
+ "ticker": ticker,
80
+ "request": request,
81
+ "nonce": nonce,
82
+ },
83
+ headers={
84
+ "content-type": "application/json",
85
+ },
86
+ request_options=request_options,
87
+ omit=OMIT,
88
+ )
89
+ try:
90
+ if 200 <= _response.status_code < 300:
91
+ _data = typing.cast(
92
+ typing.List[FixedPlan],
93
+ parse_obj_as(
94
+ type_=typing.List[FixedPlan], # type: ignore
95
+ object_=_response.json(),
96
+ ),
97
+ )
98
+ return HttpResponse(response=_response, data=_data)
99
+ if _response.status_code == 400:
100
+ raise BadRequestError(
101
+ headers=dict(_response.headers),
102
+ body=typing.cast(
103
+ typing.Optional[typing.Any],
104
+ parse_obj_as(
105
+ type_=typing.Optional[typing.Any], # type: ignore
106
+ object_=_response.json(),
107
+ ),
108
+ ),
109
+ )
110
+ _response_json = _response.json()
111
+ except JSONDecodeError:
112
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
113
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
114
+
115
+ def create_fixed_investment(
116
+ self,
117
+ *,
118
+ plan_id: str,
119
+ amount: str,
120
+ request: str,
121
+ nonce: str,
122
+ request_options: typing.Optional[RequestOptions] = None,
123
+ ) -> HttpResponse[CreateFixedInvestmentResponse]:
124
+ """
125
+ The endpoint creates a new investment to the specified [invest plan](/glossary#crypto-lending).
126
+
127
+ <Warning>
128
+ Rate limit: 1000 requests/10 sec.
129
+ </Warning>
130
+
131
+ <Note>
132
+ The API does not cache the response.
133
+ </Note>
134
+
135
+ Parameters
136
+ ----------
137
+ plan_id : str
138
+ [Invest plan](/glossary#crypto-lending) identifier
139
+
140
+ amount : str
141
+ Investment amount
142
+
143
+ request : str
144
+ Request signature
145
+
146
+ nonce : str
147
+ Unique request identifier
148
+
149
+ request_options : typing.Optional[RequestOptions]
150
+ Request-specific configuration.
151
+
152
+ Returns
153
+ -------
154
+ HttpResponse[CreateFixedInvestmentResponse]
155
+ Investment created successfully
156
+ """
157
+ _response = self._client_wrapper.httpx_client.request(
158
+ "api/v4/main-account/smart/investment",
159
+ base_url=self._client_wrapper.get_environment().base,
160
+ method="POST",
161
+ json={
162
+ "planId": plan_id,
163
+ "amount": amount,
164
+ "request": request,
165
+ "nonce": nonce,
166
+ },
167
+ headers={
168
+ "content-type": "application/json",
169
+ },
170
+ request_options=request_options,
171
+ omit=OMIT,
172
+ )
173
+ try:
174
+ if 200 <= _response.status_code < 300:
175
+ _data = typing.cast(
176
+ CreateFixedInvestmentResponse,
177
+ parse_obj_as(
178
+ type_=CreateFixedInvestmentResponse, # type: ignore
179
+ object_=_response.json(),
180
+ ),
181
+ )
182
+ return HttpResponse(response=_response, data=_data)
183
+ if _response.status_code == 400:
184
+ raise BadRequestError(
185
+ headers=dict(_response.headers),
186
+ body=typing.cast(
187
+ typing.Optional[typing.Any],
188
+ parse_obj_as(
189
+ type_=typing.Optional[typing.Any], # type: ignore
190
+ object_=_response.json(),
191
+ ),
192
+ ),
193
+ )
194
+ if _response.status_code == 422:
195
+ raise UnprocessableEntityError(
196
+ headers=dict(_response.headers),
197
+ body=typing.cast(
198
+ typing.Optional[typing.Any],
199
+ parse_obj_as(
200
+ type_=typing.Optional[typing.Any], # type: ignore
201
+ object_=_response.json(),
202
+ ),
203
+ ),
204
+ )
205
+ _response_json = _response.json()
206
+ except JSONDecodeError:
207
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
208
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
209
+
210
+ def close_fixed_investment(
211
+ self, *, id: str, request: str, nonce: str, request_options: typing.Optional[RequestOptions] = None
212
+ ) -> HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
213
+ """
214
+ The endpoint closes active investment.
215
+
216
+ <Warning>
217
+ Rate limit: 1000 requests/10 sec.
218
+ </Warning>
219
+
220
+ <Note>
221
+ The API does not cache the response.
222
+ </Note>
223
+
224
+ Parameters
225
+ ----------
226
+ id : str
227
+ Investment identifier
228
+
229
+ request : str
230
+ Request signature
231
+
232
+ nonce : str
233
+ Unique request identifier
234
+
235
+ request_options : typing.Optional[RequestOptions]
236
+ Request-specific configuration.
237
+
238
+ Returns
239
+ -------
240
+ HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
241
+ Investment closed successfully
242
+ """
243
+ _response = self._client_wrapper.httpx_client.request(
244
+ "api/v4/main-account/smart/investment/close",
245
+ base_url=self._client_wrapper.get_environment().base,
246
+ method="POST",
247
+ json={
248
+ "id": id,
249
+ "request": request,
250
+ "nonce": nonce,
251
+ },
252
+ headers={
253
+ "content-type": "application/json",
254
+ },
255
+ request_options=request_options,
256
+ omit=OMIT,
257
+ )
258
+ try:
259
+ if 200 <= _response.status_code < 300:
260
+ _data = typing.cast(
261
+ typing.Dict[str, typing.Optional[typing.Any]],
262
+ parse_obj_as(
263
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
264
+ object_=_response.json(),
265
+ ),
266
+ )
267
+ return HttpResponse(response=_response, data=_data)
268
+ if _response.status_code == 400:
269
+ raise BadRequestError(
270
+ headers=dict(_response.headers),
271
+ body=typing.cast(
272
+ typing.Optional[typing.Any],
273
+ parse_obj_as(
274
+ type_=typing.Optional[typing.Any], # type: ignore
275
+ object_=_response.json(),
276
+ ),
277
+ ),
278
+ )
279
+ _response_json = _response.json()
280
+ except JSONDecodeError:
281
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
282
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
283
+
284
+ def get_fixed_investments_history(
285
+ self,
286
+ *,
287
+ request: str,
288
+ nonce: str,
289
+ id: typing.Optional[str] = OMIT,
290
+ ticker: typing.Optional[str] = OMIT,
291
+ status: typing.Optional[int] = OMIT,
292
+ limit: typing.Optional[int] = OMIT,
293
+ offset: typing.Optional[int] = OMIT,
294
+ request_options: typing.Optional[RequestOptions] = None,
295
+ ) -> HttpResponse[GetFixedInvestmentsHistoryResponse]:
296
+ """
297
+ The endpoint retrieves an investments history.
298
+
299
+ <Warning>
300
+ Rate limit: 1000 requests/10 sec.
301
+ </Warning>
302
+
303
+ <Note>
304
+ The API does not cache the response.
305
+ </Note>
306
+
307
+ Parameters
308
+ ----------
309
+ request : str
310
+ Request signature
311
+
312
+ nonce : str
313
+ Unique request identifier
314
+
315
+ id : typing.Optional[str]
316
+ Investment identifier
317
+
318
+ ticker : typing.Optional[str]
319
+ [Invest plan](/glossary#crypto-lending) source currency's [ticker](/glossary#ticker)
320
+
321
+ status : typing.Optional[int]
322
+ Investment status (1 - active, 2 - closed)
323
+
324
+ limit : typing.Optional[int]
325
+ LIMIT is a special clause used to limit records a particular query can return.
326
+
327
+ offset : typing.Optional[int]
328
+ Use the OFFSET clause to return entries starting from a particular line.
329
+
330
+ request_options : typing.Optional[RequestOptions]
331
+ Request-specific configuration.
332
+
333
+ Returns
334
+ -------
335
+ HttpResponse[GetFixedInvestmentsHistoryResponse]
336
+ Successful response
337
+ """
338
+ _response = self._client_wrapper.httpx_client.request(
339
+ "api/v4/main-account/smart/investments",
340
+ base_url=self._client_wrapper.get_environment().base,
341
+ method="POST",
342
+ json={
343
+ "id": id,
344
+ "ticker": ticker,
345
+ "status": status,
346
+ "limit": limit,
347
+ "offset": offset,
348
+ "request": request,
349
+ "nonce": nonce,
350
+ },
351
+ headers={
352
+ "content-type": "application/json",
353
+ },
354
+ request_options=request_options,
355
+ omit=OMIT,
356
+ )
357
+ try:
358
+ if 200 <= _response.status_code < 300:
359
+ _data = typing.cast(
360
+ GetFixedInvestmentsHistoryResponse,
361
+ parse_obj_as(
362
+ type_=GetFixedInvestmentsHistoryResponse, # type: ignore
363
+ object_=_response.json(),
364
+ ),
365
+ )
366
+ return HttpResponse(response=_response, data=_data)
367
+ if _response.status_code == 400:
368
+ raise BadRequestError(
369
+ headers=dict(_response.headers),
370
+ body=typing.cast(
371
+ typing.Optional[typing.Any],
372
+ parse_obj_as(
373
+ type_=typing.Optional[typing.Any], # type: ignore
374
+ object_=_response.json(),
375
+ ),
376
+ ),
377
+ )
378
+ _response_json = _response.json()
379
+ except JSONDecodeError:
380
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
381
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
382
+
383
+ def get_interest_payment_history(
384
+ self,
385
+ *,
386
+ request: str,
387
+ nonce: str,
388
+ plan_id: typing.Optional[str] = OMIT,
389
+ ticker: typing.Optional[str] = OMIT,
390
+ limit: typing.Optional[int] = OMIT,
391
+ offset: typing.Optional[int] = OMIT,
392
+ request_options: typing.Optional[RequestOptions] = None,
393
+ ) -> HttpResponse[GetInterestPaymentHistoryResponse]:
394
+ """
395
+ The endpoint retrieves the history of interest payments.
396
+
397
+ <Warning>
398
+ Rate limit: 1000 requests/10 sec.
399
+ </Warning>
400
+
401
+ <Note>
402
+ The API does not cache the response.
403
+ </Note>
404
+
405
+ Parameters
406
+ ----------
407
+ request : str
408
+ Request signature
409
+
410
+ nonce : str
411
+ Unique request identifier
412
+
413
+ plan_id : typing.Optional[str]
414
+ [Invest plan](/glossary#crypto-lending) identifier
415
+
416
+ ticker : typing.Optional[str]
417
+ [Invest plan](/glossary#crypto-lending) target currency's [ticker](/glossary#ticker)
418
+
419
+ limit : typing.Optional[int]
420
+ LIMIT is a special clause used to limit records a particular query can return.
421
+
422
+ offset : typing.Optional[int]
423
+ Use the OFFSET clause to return entries starting from a particular line.
424
+
425
+ request_options : typing.Optional[RequestOptions]
426
+ Request-specific configuration.
427
+
428
+ Returns
429
+ -------
430
+ HttpResponse[GetInterestPaymentHistoryResponse]
431
+ Successful response
432
+ """
433
+ _response = self._client_wrapper.httpx_client.request(
434
+ "api/v4/main-account/smart/interest-payment-history",
435
+ base_url=self._client_wrapper.get_environment().base,
436
+ method="POST",
437
+ json={
438
+ "planId": plan_id,
439
+ "ticker": ticker,
440
+ "limit": limit,
441
+ "offset": offset,
442
+ "request": request,
443
+ "nonce": nonce,
444
+ },
445
+ headers={
446
+ "content-type": "application/json",
447
+ },
448
+ request_options=request_options,
449
+ omit=OMIT,
450
+ )
451
+ try:
452
+ if 200 <= _response.status_code < 300:
453
+ _data = typing.cast(
454
+ GetInterestPaymentHistoryResponse,
455
+ parse_obj_as(
456
+ type_=GetInterestPaymentHistoryResponse, # type: ignore
457
+ object_=_response.json(),
458
+ ),
459
+ )
460
+ return HttpResponse(response=_response, data=_data)
461
+ if _response.status_code == 400:
462
+ raise BadRequestError(
463
+ headers=dict(_response.headers),
464
+ body=typing.cast(
465
+ typing.Optional[typing.Any],
466
+ parse_obj_as(
467
+ type_=typing.Optional[typing.Any], # type: ignore
468
+ object_=_response.json(),
469
+ ),
470
+ ),
471
+ )
472
+ _response_json = _response.json()
473
+ except JSONDecodeError:
474
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
475
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
476
+
477
+
478
+ class AsyncRawCryptoLendingFixedClient:
479
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
480
+ self._client_wrapper = client_wrapper
481
+
482
+ async def get_fixed_plans(
483
+ self,
484
+ *,
485
+ request: str,
486
+ nonce: str,
487
+ ticker: typing.Optional[str] = OMIT,
488
+ request_options: typing.Optional[RequestOptions] = None,
489
+ ) -> AsyncHttpResponse[typing.List[FixedPlan]]:
490
+ """
491
+ The endpoint retrieves all active [plans](/glossary#crypto-lending).
492
+
493
+ <Note>
494
+ These endpoints are available only for B2B partner services. Fill the institutional services form to get permissions to use these endpoints.
495
+ </Note>
496
+
497
+ **Note:** When target currency is different from source currency, interest amount in target currency will be calculated using `interestRatio` value.
498
+
499
+ **Examples:**
500
+ - When source currency = USDT, target currency = BTC and interest ratio = 40000, interest is received in BTC and equals the USDT interest amount divided by the interest ratio (e.g. 0.000025 BTC per 1 USDT of interest).
501
+ - When source currency equals target currency, interest ratio equals 1.
502
+
503
+ <Warning>
504
+ Rate limit: 1000 requests/10 sec.
505
+ </Warning>
506
+
507
+ <Note>
508
+ The API does not cache the response.
509
+ </Note>
510
+
511
+ Parameters
512
+ ----------
513
+ request : str
514
+ Request signature
515
+
516
+ nonce : str
517
+ Unique request identifier
518
+
519
+ ticker : typing.Optional[str]
520
+ [Invest plan](/glossary#crypto-lending) source currency's [ticker](/glossary#ticker). Example: BTC
521
+
522
+ request_options : typing.Optional[RequestOptions]
523
+ Request-specific configuration.
524
+
525
+ Returns
526
+ -------
527
+ AsyncHttpResponse[typing.List[FixedPlan]]
528
+ Successful response
529
+ """
530
+ _response = await self._client_wrapper.httpx_client.request(
531
+ "api/v4/main-account/smart/plans",
532
+ base_url=self._client_wrapper.get_environment().base,
533
+ method="POST",
534
+ json={
535
+ "ticker": ticker,
536
+ "request": request,
537
+ "nonce": nonce,
538
+ },
539
+ headers={
540
+ "content-type": "application/json",
541
+ },
542
+ request_options=request_options,
543
+ omit=OMIT,
544
+ )
545
+ try:
546
+ if 200 <= _response.status_code < 300:
547
+ _data = typing.cast(
548
+ typing.List[FixedPlan],
549
+ parse_obj_as(
550
+ type_=typing.List[FixedPlan], # type: ignore
551
+ object_=_response.json(),
552
+ ),
553
+ )
554
+ return AsyncHttpResponse(response=_response, data=_data)
555
+ if _response.status_code == 400:
556
+ raise BadRequestError(
557
+ headers=dict(_response.headers),
558
+ body=typing.cast(
559
+ typing.Optional[typing.Any],
560
+ parse_obj_as(
561
+ type_=typing.Optional[typing.Any], # type: ignore
562
+ object_=_response.json(),
563
+ ),
564
+ ),
565
+ )
566
+ _response_json = _response.json()
567
+ except JSONDecodeError:
568
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
569
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
570
+
571
+ async def create_fixed_investment(
572
+ self,
573
+ *,
574
+ plan_id: str,
575
+ amount: str,
576
+ request: str,
577
+ nonce: str,
578
+ request_options: typing.Optional[RequestOptions] = None,
579
+ ) -> AsyncHttpResponse[CreateFixedInvestmentResponse]:
580
+ """
581
+ The endpoint creates a new investment to the specified [invest plan](/glossary#crypto-lending).
582
+
583
+ <Warning>
584
+ Rate limit: 1000 requests/10 sec.
585
+ </Warning>
586
+
587
+ <Note>
588
+ The API does not cache the response.
589
+ </Note>
590
+
591
+ Parameters
592
+ ----------
593
+ plan_id : str
594
+ [Invest plan](/glossary#crypto-lending) identifier
595
+
596
+ amount : str
597
+ Investment amount
598
+
599
+ request : str
600
+ Request signature
601
+
602
+ nonce : str
603
+ Unique request identifier
604
+
605
+ request_options : typing.Optional[RequestOptions]
606
+ Request-specific configuration.
607
+
608
+ Returns
609
+ -------
610
+ AsyncHttpResponse[CreateFixedInvestmentResponse]
611
+ Investment created successfully
612
+ """
613
+ _response = await self._client_wrapper.httpx_client.request(
614
+ "api/v4/main-account/smart/investment",
615
+ base_url=self._client_wrapper.get_environment().base,
616
+ method="POST",
617
+ json={
618
+ "planId": plan_id,
619
+ "amount": amount,
620
+ "request": request,
621
+ "nonce": nonce,
622
+ },
623
+ headers={
624
+ "content-type": "application/json",
625
+ },
626
+ request_options=request_options,
627
+ omit=OMIT,
628
+ )
629
+ try:
630
+ if 200 <= _response.status_code < 300:
631
+ _data = typing.cast(
632
+ CreateFixedInvestmentResponse,
633
+ parse_obj_as(
634
+ type_=CreateFixedInvestmentResponse, # type: ignore
635
+ object_=_response.json(),
636
+ ),
637
+ )
638
+ return AsyncHttpResponse(response=_response, data=_data)
639
+ if _response.status_code == 400:
640
+ raise BadRequestError(
641
+ headers=dict(_response.headers),
642
+ body=typing.cast(
643
+ typing.Optional[typing.Any],
644
+ parse_obj_as(
645
+ type_=typing.Optional[typing.Any], # type: ignore
646
+ object_=_response.json(),
647
+ ),
648
+ ),
649
+ )
650
+ if _response.status_code == 422:
651
+ raise UnprocessableEntityError(
652
+ headers=dict(_response.headers),
653
+ body=typing.cast(
654
+ typing.Optional[typing.Any],
655
+ parse_obj_as(
656
+ type_=typing.Optional[typing.Any], # type: ignore
657
+ object_=_response.json(),
658
+ ),
659
+ ),
660
+ )
661
+ _response_json = _response.json()
662
+ except JSONDecodeError:
663
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
664
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
665
+
666
+ async def close_fixed_investment(
667
+ self, *, id: str, request: str, nonce: str, request_options: typing.Optional[RequestOptions] = None
668
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
669
+ """
670
+ The endpoint closes active investment.
671
+
672
+ <Warning>
673
+ Rate limit: 1000 requests/10 sec.
674
+ </Warning>
675
+
676
+ <Note>
677
+ The API does not cache the response.
678
+ </Note>
679
+
680
+ Parameters
681
+ ----------
682
+ id : str
683
+ Investment identifier
684
+
685
+ request : str
686
+ Request signature
687
+
688
+ nonce : str
689
+ Unique request identifier
690
+
691
+ request_options : typing.Optional[RequestOptions]
692
+ Request-specific configuration.
693
+
694
+ Returns
695
+ -------
696
+ AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
697
+ Investment closed successfully
698
+ """
699
+ _response = await self._client_wrapper.httpx_client.request(
700
+ "api/v4/main-account/smart/investment/close",
701
+ base_url=self._client_wrapper.get_environment().base,
702
+ method="POST",
703
+ json={
704
+ "id": id,
705
+ "request": request,
706
+ "nonce": nonce,
707
+ },
708
+ headers={
709
+ "content-type": "application/json",
710
+ },
711
+ request_options=request_options,
712
+ omit=OMIT,
713
+ )
714
+ try:
715
+ if 200 <= _response.status_code < 300:
716
+ _data = typing.cast(
717
+ typing.Dict[str, typing.Optional[typing.Any]],
718
+ parse_obj_as(
719
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
720
+ object_=_response.json(),
721
+ ),
722
+ )
723
+ return AsyncHttpResponse(response=_response, data=_data)
724
+ if _response.status_code == 400:
725
+ raise BadRequestError(
726
+ headers=dict(_response.headers),
727
+ body=typing.cast(
728
+ typing.Optional[typing.Any],
729
+ parse_obj_as(
730
+ type_=typing.Optional[typing.Any], # type: ignore
731
+ object_=_response.json(),
732
+ ),
733
+ ),
734
+ )
735
+ _response_json = _response.json()
736
+ except JSONDecodeError:
737
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
738
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
739
+
740
+ async def get_fixed_investments_history(
741
+ self,
742
+ *,
743
+ request: str,
744
+ nonce: str,
745
+ id: typing.Optional[str] = OMIT,
746
+ ticker: typing.Optional[str] = OMIT,
747
+ status: typing.Optional[int] = OMIT,
748
+ limit: typing.Optional[int] = OMIT,
749
+ offset: typing.Optional[int] = OMIT,
750
+ request_options: typing.Optional[RequestOptions] = None,
751
+ ) -> AsyncHttpResponse[GetFixedInvestmentsHistoryResponse]:
752
+ """
753
+ The endpoint retrieves an investments history.
754
+
755
+ <Warning>
756
+ Rate limit: 1000 requests/10 sec.
757
+ </Warning>
758
+
759
+ <Note>
760
+ The API does not cache the response.
761
+ </Note>
762
+
763
+ Parameters
764
+ ----------
765
+ request : str
766
+ Request signature
767
+
768
+ nonce : str
769
+ Unique request identifier
770
+
771
+ id : typing.Optional[str]
772
+ Investment identifier
773
+
774
+ ticker : typing.Optional[str]
775
+ [Invest plan](/glossary#crypto-lending) source currency's [ticker](/glossary#ticker)
776
+
777
+ status : typing.Optional[int]
778
+ Investment status (1 - active, 2 - closed)
779
+
780
+ limit : typing.Optional[int]
781
+ LIMIT is a special clause used to limit records a particular query can return.
782
+
783
+ offset : typing.Optional[int]
784
+ Use the OFFSET clause to return entries starting from a particular line.
785
+
786
+ request_options : typing.Optional[RequestOptions]
787
+ Request-specific configuration.
788
+
789
+ Returns
790
+ -------
791
+ AsyncHttpResponse[GetFixedInvestmentsHistoryResponse]
792
+ Successful response
793
+ """
794
+ _response = await self._client_wrapper.httpx_client.request(
795
+ "api/v4/main-account/smart/investments",
796
+ base_url=self._client_wrapper.get_environment().base,
797
+ method="POST",
798
+ json={
799
+ "id": id,
800
+ "ticker": ticker,
801
+ "status": status,
802
+ "limit": limit,
803
+ "offset": offset,
804
+ "request": request,
805
+ "nonce": nonce,
806
+ },
807
+ headers={
808
+ "content-type": "application/json",
809
+ },
810
+ request_options=request_options,
811
+ omit=OMIT,
812
+ )
813
+ try:
814
+ if 200 <= _response.status_code < 300:
815
+ _data = typing.cast(
816
+ GetFixedInvestmentsHistoryResponse,
817
+ parse_obj_as(
818
+ type_=GetFixedInvestmentsHistoryResponse, # type: ignore
819
+ object_=_response.json(),
820
+ ),
821
+ )
822
+ return AsyncHttpResponse(response=_response, data=_data)
823
+ if _response.status_code == 400:
824
+ raise BadRequestError(
825
+ headers=dict(_response.headers),
826
+ body=typing.cast(
827
+ typing.Optional[typing.Any],
828
+ parse_obj_as(
829
+ type_=typing.Optional[typing.Any], # type: ignore
830
+ object_=_response.json(),
831
+ ),
832
+ ),
833
+ )
834
+ _response_json = _response.json()
835
+ except JSONDecodeError:
836
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
837
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
838
+
839
+ async def get_interest_payment_history(
840
+ self,
841
+ *,
842
+ request: str,
843
+ nonce: str,
844
+ plan_id: typing.Optional[str] = OMIT,
845
+ ticker: typing.Optional[str] = OMIT,
846
+ limit: typing.Optional[int] = OMIT,
847
+ offset: typing.Optional[int] = OMIT,
848
+ request_options: typing.Optional[RequestOptions] = None,
849
+ ) -> AsyncHttpResponse[GetInterestPaymentHistoryResponse]:
850
+ """
851
+ The endpoint retrieves the history of interest payments.
852
+
853
+ <Warning>
854
+ Rate limit: 1000 requests/10 sec.
855
+ </Warning>
856
+
857
+ <Note>
858
+ The API does not cache the response.
859
+ </Note>
860
+
861
+ Parameters
862
+ ----------
863
+ request : str
864
+ Request signature
865
+
866
+ nonce : str
867
+ Unique request identifier
868
+
869
+ plan_id : typing.Optional[str]
870
+ [Invest plan](/glossary#crypto-lending) identifier
871
+
872
+ ticker : typing.Optional[str]
873
+ [Invest plan](/glossary#crypto-lending) target currency's [ticker](/glossary#ticker)
874
+
875
+ limit : typing.Optional[int]
876
+ LIMIT is a special clause used to limit records a particular query can return.
877
+
878
+ offset : typing.Optional[int]
879
+ Use the OFFSET clause to return entries starting from a particular line.
880
+
881
+ request_options : typing.Optional[RequestOptions]
882
+ Request-specific configuration.
883
+
884
+ Returns
885
+ -------
886
+ AsyncHttpResponse[GetInterestPaymentHistoryResponse]
887
+ Successful response
888
+ """
889
+ _response = await self._client_wrapper.httpx_client.request(
890
+ "api/v4/main-account/smart/interest-payment-history",
891
+ base_url=self._client_wrapper.get_environment().base,
892
+ method="POST",
893
+ json={
894
+ "planId": plan_id,
895
+ "ticker": ticker,
896
+ "limit": limit,
897
+ "offset": offset,
898
+ "request": request,
899
+ "nonce": nonce,
900
+ },
901
+ headers={
902
+ "content-type": "application/json",
903
+ },
904
+ request_options=request_options,
905
+ omit=OMIT,
906
+ )
907
+ try:
908
+ if 200 <= _response.status_code < 300:
909
+ _data = typing.cast(
910
+ GetInterestPaymentHistoryResponse,
911
+ parse_obj_as(
912
+ type_=GetInterestPaymentHistoryResponse, # type: ignore
913
+ object_=_response.json(),
914
+ ),
915
+ )
916
+ return AsyncHttpResponse(response=_response, data=_data)
917
+ if _response.status_code == 400:
918
+ raise BadRequestError(
919
+ headers=dict(_response.headers),
920
+ body=typing.cast(
921
+ typing.Optional[typing.Any],
922
+ parse_obj_as(
923
+ type_=typing.Optional[typing.Any], # type: ignore
924
+ object_=_response.json(),
925
+ ),
926
+ ),
927
+ )
928
+ _response_json = _response.json()
929
+ except JSONDecodeError:
930
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
931
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)