Add funding related rest endpoints, refactor pre-existent rest endpoints to use get_ prefix. Add function to calculate flags easily. Add example test to create a funding offer.

This commit is contained in:
itsdeka
2023-01-06 15:18:57 +01:00
committed by Davide Casale
parent 72a3252e32
commit ef836bbe1a
7 changed files with 170 additions and 37 deletions

29
bfxapi/utils/flags.py Normal file
View File

@@ -0,0 +1,29 @@
from .. enums import Flag
def calculate_order_flags(
hidden : bool = False,
close : bool = False,
reduce_only : bool = False,
post_only : bool = False,
oco : bool = False,
no_var_rates: bool = False
) -> int:
flags = 0
if hidden: flags += Flag.HIDDEN
if close: flags += Flag.CLOSE
if reduce_only: flags += Flag.REDUCE_ONLY
if post_only: flags += Flag.POST_ONLY
if oco: flags += Flag.OCO
if no_var_rates: flags += Flag.NO_VAR_RATES
return flags
def calculate_offer_flags(
hidden : bool = False
) -> int:
flags = 0
if hidden: flags += Flag.HIDDEN
return flags