Browse Source

typo

pull/14/head
Erwan Fagnou 1 year ago
committed by QuentinN42
parent
commit
0d41f3f9ed
Signed by: number42 GPG Key ID: 2CD7D563712B3A50
  1. 2
      auto_trading/interfaces.py
  2. 4
      auto_trading/ptf/in_memory.py
  3. 2
      auto_trading/strat/all_in.py

2
auto_trading/interfaces.py

@ -14,7 +14,7 @@ class Portfolio(ABC):
"""return the content in each currency"""
@abstractmethod
def widraw(self, amount: int, currency: str) -> None:
def withdraw(self, amount: int, currency: str) -> None:
"""Withdraw money from the portfolio"""
@abstractmethod

4
auto_trading/ptf/in_memory.py

@ -12,7 +12,7 @@ class InMemoryPortfolio(Portfolio):
"""return the content in each currency"""
return self.currency
def widraw(self, amount: int, currency: str) -> None:
def withdraw(self, amount: int, currency: str) -> None:
"""Withdraw money from the portfolio"""
if self.currency[currency] < amount:
raise ValueError("Not enough money")
@ -24,5 +24,5 @@ class InMemoryPortfolio(Portfolio):
def convert(self, amount: int, to_amount: int, currency: str, to_currency: str) -> None:
"""Convert money from one currency to another"""
self.widraw(amount, currency)
self.withdraw(amount, currency)
self.deposit(to_amount, to_currency)

2
auto_trading/strat/all_in.py

@ -15,7 +15,7 @@ class AllIn(Strategy):
#print(f"{stock}: {amount}")
if amount > 0:
money += current_conversion_rate[stock]*amount
ptf.widraw(amount, stock)
ptf.withdraw(amount, stock)
# after get the greatest result
result = {k:-1 if np.isnan(v) else v for k,v in result.items() }

Loading…
Cancel
Save