openfund-maker 1.0.6__py3-none-any.whl → 1.0.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maker/ThreeLineOrderBot.py +20 -7
- {openfund_maker-1.0.6.dist-info → openfund_maker-1.0.7.dist-info}/METADATA +1 -1
- {openfund_maker-1.0.6.dist-info → openfund_maker-1.0.7.dist-info}/RECORD +5 -5
- {openfund_maker-1.0.6.dist-info → openfund_maker-1.0.7.dist-info}/WHEEL +0 -0
- {openfund_maker-1.0.6.dist-info → openfund_maker-1.0.7.dist-info}/entry_points.txt +0 -0
maker/ThreeLineOrderBot.py
CHANGED
@@ -288,7 +288,7 @@ class ThreeLineOrdergBot:
|
|
288
288
|
'params': params
|
289
289
|
}
|
290
290
|
# 使用ccxt创建订单
|
291
|
-
|
291
|
+
self.logger.debug(f"Pre Order placed: {order} ")
|
292
292
|
order_result = self.exchange.create_order(
|
293
293
|
**order
|
294
294
|
# symbol=symbol,
|
@@ -298,7 +298,7 @@ class ThreeLineOrdergBot:
|
|
298
298
|
# price=float(adjusted_price),
|
299
299
|
# params=params
|
300
300
|
)
|
301
|
-
self.logger.debug(f"{symbol} ++ Order placed rs : {order_result}")
|
301
|
+
# self.logger.debug(f"{symbol} ++ Order placed rs : {order_result}")
|
302
302
|
except Exception as e:
|
303
303
|
self.logger.error(f"{symbol} Failed to place order: {e}")
|
304
304
|
self.logger.info(f"--------- ++ {symbol} Order placed done! --------")
|
@@ -359,8 +359,21 @@ class ThreeLineOrdergBot:
|
|
359
359
|
'index': None
|
360
360
|
}
|
361
361
|
|
362
|
-
|
363
|
-
|
362
|
+
def judge_ma_direction(self,fastklines,slowklines) -> bool:
|
363
|
+
df = pd.DataFrame()
|
364
|
+
df['ema'] = fastklines
|
365
|
+
df['sma'] = slowklines
|
366
|
+
# 快线和慢线的差值
|
367
|
+
df['diff'] = df['ema']-df['sma']
|
368
|
+
# 计算斜率,【正】表示两线距离扩张,【负】表示两线距离收缩
|
369
|
+
df['slope'] = df['diff'].abs().diff().round(6)
|
370
|
+
|
371
|
+
#
|
372
|
+
return df['slope'].iloc[-1] > 0
|
373
|
+
# df['statu'] = df['slope']
|
374
|
+
|
375
|
+
|
376
|
+
def calculate_range_diff(self,prices:pd.Series) -> float:
|
364
377
|
"""
|
365
378
|
计算价格列表中最后一个价格与第一个价格的差值。
|
366
379
|
Args:
|
@@ -393,7 +406,7 @@ class ThreeLineOrdergBot:
|
|
393
406
|
place_order_price = None
|
394
407
|
# 计算止盈价格,用市场价格(取持仓期间历史最高)减去开仓价格的利润,再乘以不同阶段的止盈百分比。
|
395
408
|
|
396
|
-
if side == '
|
409
|
+
if side == 'buy':
|
397
410
|
place_order_price = base_price * (1- amplitude_limit/100) - offset * tick_size
|
398
411
|
else:
|
399
412
|
place_order_price = base_price * (1 + amplitude_limit/100) + offset * tick_size
|
@@ -499,7 +512,7 @@ class ThreeLineOrdergBot:
|
|
499
512
|
close_price = klines[-1][4]
|
500
513
|
self.logger.debug(f"-- {symbol} 最新K线 {klines[-1]}")
|
501
514
|
if is_bullish_trend:
|
502
|
-
diff = self.
|
515
|
+
diff = self.calculate_range_diff(prices=low_prices)
|
503
516
|
cur_amplitude_limit = diff / close_price * 100
|
504
517
|
self.logger.info(f"{symbol} 当前为上升(多)趋势,允许挂多单,振幅{cur_amplitude_limit:.3f} hight/low {max(low_prices)}/{min(low_prices)} ++")
|
505
518
|
# 振幅大于限制,直接下单,否则,根据振幅计算下单价格
|
@@ -511,7 +524,7 @@ class ThreeLineOrdergBot:
|
|
511
524
|
|
512
525
|
|
513
526
|
if is_bearish_trend:
|
514
|
-
diff = self.
|
527
|
+
diff = self.calculate_range_diff(prices=high_prices)
|
515
528
|
cur_amplitude_limit = diff / close_price * 100
|
516
529
|
self.logger.info(f"{symbol} 当前为下降(空)趋势,允许挂空单,振幅{cur_amplitude_limit:.3f} hight/low {max(high_prices)}/{min(high_prices)}--")
|
517
530
|
if cur_amplitude_limit >= amplitude_limit:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
maker/ThreeLineOrderBot.py,sha256=
|
1
|
+
maker/ThreeLineOrderBot.py,sha256=5ye25LP090vITVieCCVDB2bZndfndKv8od7vfuXB6ZM,23768
|
2
2
|
maker/WickReversalOrderBot.py,sha256=Oc6wChdWu39lfWh3NRHM8BqvaRIYDNZiDR6PDnE9XUM,17374
|
3
3
|
maker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
maker/config.py,sha256=YPxghO5i0vgRg9Cja8kGj9O7pgSbbtzOgf3RexqXXwY,1188
|
@@ -7,7 +7,7 @@ maker/main_m.py,sha256=0PzDTnuBrxfpy5WDfsIHKAzZ_7pkuvuqqeWik0vpWio,15522
|
|
7
7
|
maker/okxapi.py,sha256=_9G0U_o0ZC8NxaT6PqpiLgxBm9gPobC9PsFHZE1c5w0,553
|
8
8
|
maker/zhen.py.bak,sha256=HNkrQbJts8G9umE9chEFsc0cLQApcM9KOVNMYPpkBXM,10918
|
9
9
|
maker/zhen_2.py,sha256=4IaHVtTCMSlrLGSTZrWpW2q-f7HZsUNRkW_-5QgWv24,10509
|
10
|
-
openfund_maker-1.0.
|
11
|
-
openfund_maker-1.0.
|
12
|
-
openfund_maker-1.0.
|
13
|
-
openfund_maker-1.0.
|
10
|
+
openfund_maker-1.0.7.dist-info/METADATA,sha256=5cr-Ut4VsPUudjFfDdUCcG2mclOZ30gIlrKD278wmiE,1965
|
11
|
+
openfund_maker-1.0.7.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
12
|
+
openfund_maker-1.0.7.dist-info/entry_points.txt,sha256=gKMytICEKcMRFQDFkHZLnIpID7UQFoTIM_xcpiiV6Ns,50
|
13
|
+
openfund_maker-1.0.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|