Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Keywords] add QUOTE_VALUE QuantityType #861

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions octobot_trading/modes/script_keywords/basic_keywords/amount.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ async def get_amount_from_input_amount(
elif amount_type is dsl.QuantityType.AVAILABLE_PERCENT:
amount_value = await account_balance.available_account_balance(context, side, reduce_only=reduce_only) \
* amount_value / 100
elif amount_type is dsl.QuantityType.QUOTE_VALUE:
if (context.exchange_manager.is_future
and context.exchange_manager.exchange.is_inverse_symbol(context.symbol)
):
# is measured in QUOTE_VALUE
pass
else:
# avoid circular import error
import tentacles.Meta.Keywords.scripting_library.data.reading.exchange_public_data as exchange_public_data
Comment on lines +52 to +53
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another way to handle imports in the scripting library to avoid circular imports?

amount_value = amount_value / await exchange_public_data.current_live_price(context)
elif amount_type is dsl.QuantityType.POSITION_PERCENT:
raise NotImplementedError(amount_type)
else:
Expand Down
1 change: 1 addition & 0 deletions octobot_trading/modes/script_keywords/dsl/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class QuantityType(enum.Enum):
ENTRY = "e"
AVAILABLE_PERCENT = "a%"
POSITION_PERCENT = "p%"
QUOTE_VALUE = "$"
ENTRY_PERCENT = "e%"
FLAT = "@"
UNKNOWN = "?"
Expand Down