Skip to content

Commit 4b96b63

Browse files
authored
Merge pull request #13 from paveldat/dev/pdat
Update Dobby
2 parents 536c350 + e2d7bd0 commit 4b96b63

32 files changed

+94
-78
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__pycache__
2+
img

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
worker: python3 -m binance_trade_bot
1+
worker: python3 -m dobby_trade_bot

Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ If you are interested in running a Telegram bot, more information can be found a
111111

112112
## Run
113113
```shell
114-
python -m binance_trade_bot
114+
python -m dobby_trade_bot
115115
```
116116

117117
## Database Viewer (for Windows only)

binance_trade_bot/crypto.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

ca.cfg

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111

1212

1313
class AutoTrader:
14-
def __init__(self, binance_manager: BinanceAPIManager, database: Database, logger: Logger, config: Config):
14+
def __init__(
15+
self,
16+
binance_manager: BinanceAPIManager,
17+
database: Database,
18+
logger: Logger,
19+
config: Config,
20+
):
1521
self.manager = binance_manager
1622
self.db = database
1723
self.logger = logger
@@ -54,7 +60,7 @@ def update_trade_threshold(self, coin: Coin, coin_price: float):
5460
"""
5561

5662
if coin_price is None:
57-
self.logger.info("Skipping update... current coin {} not found".format(coin + self.config.BRIDGE))
63+
self.logger.info(f"Skipping update... current coin {coin + self.config.BRIDGE} not found")
5864
return
5965

6066
session: Session
@@ -63,9 +69,7 @@ def update_trade_threshold(self, coin: Coin, coin_price: float):
6369
from_coin_price = self.manager.get_ticker_price(pair.from_coin + self.config.BRIDGE)
6470

6571
if from_coin_price is None:
66-
self.logger.info(
67-
"Skipping update for coin {} not found".format(pair.from_coin + self.config.BRIDGE)
68-
)
72+
self.logger.info(f"Skipping update for coin {pair.from_coin + self.config.BRIDGE} not found")
6973
continue
7074

7175
pair.ratio = from_coin_price / coin_price
@@ -83,16 +87,12 @@ def initialize_trade_thresholds(self):
8387

8488
from_coin_price = self.manager.get_ticker_price(pair.from_coin + self.config.BRIDGE)
8589
if from_coin_price is None:
86-
self.logger.info(
87-
"Skipping initializing {}, symbol not found".format(pair.from_coin + self.config.BRIDGE)
88-
)
90+
self.logger.info(f"Skipping initializing {pair.from_coin + self.config.BRIDGE}, symbol not found")
8991
continue
9092

9193
to_coin_price = self.manager.get_ticker_price(pair.to_coin + self.config.BRIDGE)
9294
if to_coin_price is None:
93-
self.logger.info(
94-
"Skipping initializing {}, symbol not found".format(pair.to_coin + self.config.BRIDGE)
95-
)
95+
self.logger.info(f"Skipping initializing {pair.to_coin + self.config.BRIDGE}, symbol not found")
9696
continue
9797

9898
pair.ratio = from_coin_price / to_coin_price
@@ -113,9 +113,7 @@ def _get_ratios(self, coin: Coin, coin_price):
113113
optional_coin_price = self.manager.get_ticker_price(pair.to_coin + self.config.BRIDGE)
114114

115115
if optional_coin_price is None:
116-
self.logger.info(
117-
"Skipping scouting... optional coin {} not found".format(pair.to_coin + self.config.BRIDGE)
118-
)
116+
self.logger.info(f"Skipping scouting... optional coin {pair.to_coin + self.config.BRIDGE} not found")
119117
continue
120118

121119
self.db.log_scout(pair, pair.ratio, coin_price, optional_coin_price)
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ def buy_alt(self, origin_coin: Coin, target_coin: Coin):
8686
f"{self.balances[target_symbol]}"
8787
)
8888

89-
event = defaultdict(lambda: None, order_price=from_coin_price, cumulative_quote_asset_transacted_quantity=0)
89+
event = defaultdict(
90+
lambda: None,
91+
order_price=from_coin_price,
92+
cumulative_quote_asset_transacted_quantity=0,
93+
)
9094

9195
return BinanceOrder(event)
9296

@@ -132,7 +136,13 @@ class MockDatabase(Database):
132136
def __init__(self, logger: Logger, config: Config):
133137
super().__init__(logger, config, "sqlite:///")
134138

135-
def log_scout(self, pair: Pair, target_ratio: float, current_coin_price: float, other_coin_price: float):
139+
def log_scout(
140+
self,
141+
pair: Pair,
142+
target_ratio: float,
143+
current_coin_price: float,
144+
other_coin_price: float,
145+
):
136146
pass
137147

138148

0 commit comments

Comments
 (0)