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

Fix/leverage type (from decimal to int) #6504

Merged
merged 5 commits into from Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions hummingbot/smart_components/position_executor/data_types.py
@@ -1,4 +1,3 @@
import time
from enum import Enum
from typing import Optional

Expand All @@ -15,6 +14,7 @@ class TrailingStop(BaseModel):


class PositionConfig(BaseModel):
timestamp: float
trading_pair: str
exchange: str
side: TradeType
Expand All @@ -24,12 +24,11 @@ class PositionConfig(BaseModel):
trailing_stop: Optional[TrailingStop] = None
time_limit: Optional[int] = None
entry_price: Optional[Decimal] = None
timestamp: float = time.time()
open_order_type: OrderType = OrderType.MARKET
take_profit_order_type: OrderType = OrderType.MARKET
stop_loss_order_type: OrderType = OrderType.MARKET
time_limit_order_type: OrderType = OrderType.MARKET
leverage: Decimal = Decimal("1")
leverage: int = 1


class PositionExecutorStatus(Enum):
Expand Down
8 changes: 4 additions & 4 deletions hummingbot/strategy/directional_strategy_base.py
Expand Up @@ -171,17 +171,17 @@ def get_position_config(self):
exchange=self.exchange,
side=side,
amount=self.order_amount_usd / price,
take_profit=self.take_profit,
stop_loss=self.stop_loss,
take_profit=Decimal(self.take_profit),
stop_loss=Decimal(self.stop_loss),
time_limit=self.time_limit,
entry_price=price,
open_order_type=self.open_order_type,
take_profit_order_type=self.take_profit_order_type,
stop_loss_order_type=self.stop_loss_order_type,
time_limit_order_type=self.time_limit_order_type,
trailing_stop=TrailingStop(
activation_price_delta=self.trailing_stop_activation_delta,
trailing_delta=self.trailing_stop_trailing_delta
activation_price_delta=Decimal(self.trailing_stop_activation_delta),
trailing_delta=Decimal(self.trailing_stop_trailing_delta)
),
leverage=self.leverage,
)
Expand Down