diff --git a/bfxapi/utils/flags.py b/bfxapi/utils/flags.py deleted file mode 100644 index f897103..0000000 --- a/bfxapi/utils/flags.py +++ /dev/null @@ -1,29 +0,0 @@ -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 \ No newline at end of file diff --git a/examples/rest/create_funding_offer.py b/examples/rest/create_funding_offer.py index fd10cc8..c1031d8 100644 --- a/examples/rest/create_funding_offer.py +++ b/examples/rest/create_funding_offer.py @@ -3,8 +3,7 @@ import os from bfxapi.client import Client, Constants -from bfxapi.enums import FundingOfferType -from bfxapi.utils.flags import calculate_offer_flags +from bfxapi.enums import FundingOfferType, Flag bfx = Client( REST_HOST=Constants.REST_HOST, @@ -18,7 +17,7 @@ notification = bfx.rest.auth.submit_funding_offer( amount="123.45", rate="0.001", period=2, - flags=calculate_offer_flags(hidden=True) + flags=Flag.HIDDEN ) print("Offer notification:", notification) diff --git a/examples/rest/create_order.py b/examples/rest/create_order.py index 2c13ae2..ea70265 100644 --- a/examples/rest/create_order.py +++ b/examples/rest/create_order.py @@ -1,10 +1,8 @@ # python -c "import examples.rest.create_order" import os - from bfxapi.client import Client, Constants -from bfxapi.enums import OrderType -from bfxapi.utils.flags import calculate_order_flags +from bfxapi.enums import OrderType, Flag bfx = Client( REST_HOST=Constants.REST_HOST, @@ -18,7 +16,7 @@ submitted_order = bfx.rest.auth.submit_order( symbol="tBTCUST", amount="0.015", price="10000", - flags=calculate_order_flags(hidden=False) + flags=Flag.HIDDEN + Flag.OCO + Flag.CLOSE ) print("Submit Order Notification:", submitted_order)