@@ -1005,6 +1005,78 @@ async def claim_position(self, position_id, amount):
10051005 message = await self .post (endpoint , payload )
10061006 return message
10071007
1008+ async def calc_order_avail (self , symbol , type , lev , dir = None , rate = None ):
1009+ """
1010+ Calculate the balance available for orders/offers
1011+
1012+ # Attributes
1013+ @param symbol str: Symbol (tBTCUSD, tBTCUST, fUSD, .... )
1014+ @param dir int: Direction of the order (1 for by, -1 for sell) (Mandator for EXCHANGE and MARGIN type, not used for FUNDING)
1015+ @param rate str: Order price (Mandator for EXCHANGE and MARGIN type, not used for FUNDING)
1016+ @param type str: Type of the order/offer EXCHANGE, MARGIN, DERIV, or FUNDING
1017+ @param lev str: Leverage that you want to use in calculating the max order amount (DERIV only)
1018+ """
1019+ endpoint = f"auth/calc/order/avail"
1020+ payload = {
1021+ "symbol" : symbol ,
1022+ "type" : type ,
1023+ "lev" : lev
1024+ }
1025+
1026+ if dir :
1027+ payload ["dir" ] = dir
1028+
1029+ if rate :
1030+ payload ["rate" ] = rate
1031+
1032+ message = await self .post (endpoint , payload )
1033+ return message
1034+
1035+ async def write_user_settings (self , settings ):
1036+ """
1037+ Allows you to create custom settings by creating key: value pairs
1038+
1039+ # Attributes
1040+ @param Settings object: object of keys and values to be set. Must follow regex pattern /^api:[A-Za-z0-9_-]*$/
1041+ """
1042+ endpoint = f"auth/w/settings/set"
1043+ payload = {
1044+ "Settings" : settings
1045+ }
1046+
1047+ message = await self .post (endpoint , payload )
1048+ return message
1049+
1050+ async def read_user_settings (self , keys ):
1051+ """
1052+ Allows you to read custom settings by providing a key
1053+
1054+ # Attributes
1055+ @param Keys array: the keys for which you wish to retrieve the values
1056+ """
1057+ endpoint = f"auth/w/settings"
1058+ payload = {
1059+ "Keys" : keys
1060+ }
1061+
1062+ message = await self .post (endpoint , payload )
1063+ return message
1064+
1065+ async def delete_user_settings (self , settings ):
1066+ """
1067+ Allows you to delete custom settings
1068+
1069+ # Attributes
1070+ @param settings object: object of keys to be deleted followed by value 1. Must follow regex pattern /^api:[A-Za-z0-9_-]*$/
1071+ """
1072+ endpoint = f"auth/w/settings/del"
1073+ payload = {
1074+ "Settings" : settings
1075+ }
1076+
1077+ message = await self .post (endpoint , payload )
1078+ return message
1079+
10081080 async def get_auth_pulse_hist (self , is_public = None ):
10091081 """
10101082 Allows you to retrieve your private pulse history or the public pulse history with an additional UID_LIKED field.
0 commit comments