openfund-core 0.0.4__py3-none-any.whl → 1.0.5__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.
Files changed (43) hide show
  1. core/Exchange.py +533 -0
  2. core/main.py +23 -0
  3. core/smc/SMCBase.py +130 -0
  4. core/smc/SMCFVG.py +86 -0
  5. core/smc/SMCLiquidity.py +7 -0
  6. core/smc/SMCOrderBlock.py +280 -0
  7. core/smc/SMCPDArray.py +75 -0
  8. core/smc/SMCStruct.py +296 -0
  9. core/smc/__init__.py +0 -0
  10. core/utils/OPTools.py +30 -0
  11. openfund_core-1.0.5.dist-info/METADATA +48 -0
  12. openfund_core-1.0.5.dist-info/RECORD +15 -0
  13. {openfund_core-0.0.4.dist-info → openfund_core-1.0.5.dist-info}/WHEEL +1 -1
  14. openfund_core-1.0.5.dist-info/entry_points.txt +3 -0
  15. openfund/core/__init__.py +0 -14
  16. openfund/core/api_tools/__init__.py +0 -16
  17. openfund/core/api_tools/binance_futures_tools.py +0 -23
  18. openfund/core/api_tools/binance_tools.py +0 -26
  19. openfund/core/api_tools/enums.py +0 -539
  20. openfund/core/base_collector.py +0 -72
  21. openfund/core/base_tool.py +0 -58
  22. openfund/core/factory.py +0 -97
  23. openfund/core/openfund_old/continuous_klines.py +0 -153
  24. openfund/core/openfund_old/depth.py +0 -92
  25. openfund/core/openfund_old/historical_trades.py +0 -123
  26. openfund/core/openfund_old/index_info.py +0 -67
  27. openfund/core/openfund_old/index_price_kline.py +0 -118
  28. openfund/core/openfund_old/klines.py +0 -95
  29. openfund/core/openfund_old/klines_qrr.py +0 -103
  30. openfund/core/openfund_old/mark_price.py +0 -121
  31. openfund/core/openfund_old/mark_price_klines.py +0 -122
  32. openfund/core/openfund_old/ticker_24hr_price_change.py +0 -99
  33. openfund/core/pyopenfund.py +0 -85
  34. openfund/core/services/um_futures_collector.py +0 -142
  35. openfund/core/sycu_exam/__init__.py +0 -1
  36. openfund/core/sycu_exam/exam.py +0 -19
  37. openfund/core/sycu_exam/random_grade_cplus.py +0 -440
  38. openfund/core/sycu_exam/random_grade_web.py +0 -404
  39. openfund/core/utils/time_tools.py +0 -25
  40. openfund_core-0.0.4.dist-info/LICENSE +0 -201
  41. openfund_core-0.0.4.dist-info/METADATA +0 -67
  42. openfund_core-0.0.4.dist-info/RECORD +0 -30
  43. {openfund/core/openfund_old → core}/__init__.py +0 -0
core/smc/SMCStruct.py ADDED
@@ -0,0 +1,296 @@
1
+ import logging
2
+ import operator
3
+ from core.utils.OPTools import OPTools
4
+ from core.smc.SMCBase import SMCBase
5
+
6
+ class SMCStruct(SMCBase):
7
+ BULLISH_TREND = 'Bullish'
8
+ BEARISH_TREND = 'Bearish'
9
+ STRUCT_COL = "struct"
10
+ STRUCT_HIGH_COL = "struct_high"
11
+ STRUCT_LOW_COL = "struct_low"
12
+ STRUCT_MID_COL = "struct_mid"
13
+ STRUCT_HIGH_INDEX_COL = "struct_high_index"
14
+ STRUCT_LOW_INDEX_COL = "struct_low_index"
15
+ STRUCT_DIRECTION_COL = "struct_direction"
16
+ HIGH_START_COL = "high_start"
17
+ LOW_START_COL = "low_start"
18
+
19
+ def __init__(self):
20
+ super().__init__()
21
+ self.logger = logging.getLogger(__name__)
22
+
23
+
24
+ def build_struct(self, data, is_struct_body_break=True):
25
+ """处理价格结构,识别高低点突破和结构方向
26
+
27
+ Args:
28
+ df: 数据框
29
+ window: 寻找结构极值的窗口大小
30
+ is_struct_body_break: 是否使用收盘价判断突破
31
+
32
+ Returns:
33
+ 处理后的数据框,包含结构相关列
34
+ """
35
+ # 复制数据并去掉最后一条记录,因为最后一条记录不是完成状态的K线
36
+ df = data.copy().iloc[:-1]
37
+ check_columns = [self.HIGH_COL, self.LOW_COL, self.CLOSE_COL]
38
+ self.check_columns(df, check_columns)
39
+
40
+ # 初始化结构相关列
41
+ # 定义结构相关的列名
42
+ struct_columns = [self.STRUCT_COL, self.STRUCT_HIGH_COL, self.STRUCT_LOW_COL,
43
+ self.STRUCT_HIGH_INDEX_COL, self.STRUCT_LOW_INDEX_COL, self.STRUCT_DIRECTION_COL]
44
+
45
+ # 初始化结构相关列的默认值
46
+ default_values = {
47
+ self.STRUCT_COL: None, # 结构类型列初始化为None
48
+ self.STRUCT_HIGH_COL: self.toDecimal('0.0'), # 结构高点价格初始化为0
49
+ self.STRUCT_LOW_COL: self.toDecimal('0.0'), # 结构低点价格初始化为0
50
+ self.STRUCT_HIGH_INDEX_COL: 0, # 结构高点索引初始化为0
51
+ self.STRUCT_LOW_INDEX_COL: 0, # 结构低点索引初始化为0
52
+ self.STRUCT_DIRECTION_COL: None # 结构方向初始化为0
53
+ }
54
+
55
+ # 为每个结构列赋默认值
56
+ for col in struct_columns:
57
+ df[col] = default_values[col]
58
+
59
+ # 初始化结构变量
60
+ structure = {
61
+ self.HIGH_COL: df[self.HIGH_COL].iloc[0],
62
+ self.LOW_COL: df[self.LOW_COL].iloc[0],
63
+ self.HIGH_START_COL: -1,
64
+ self.LOW_START_COL: -1,
65
+ 'direction': 0
66
+ }
67
+
68
+ # 确定突破判断列
69
+ break_price_col = self.CLOSE_COL if is_struct_body_break else self.HIGH_COL
70
+ break_price_col_low = self.CLOSE_COL if is_struct_body_break else self.LOW_COL
71
+
72
+ for i in range(1, len(df)):
73
+ curr_prices = {
74
+ self.HIGH_COL: df[break_price_col].iloc[i],
75
+ self.LOW_COL: df[break_price_col_low].iloc[i]
76
+ }
77
+
78
+ # 获取前3根K线价格
79
+ prev_prices = {
80
+ self.HIGH_COL: df[break_price_col].iloc[i-3:i].values,
81
+ self.LOW_COL: df[break_price_col_low].iloc[i-3:i].values
82
+ }
83
+
84
+ # 判断结构突破
85
+ is_high_broken = self._check_structure_break(
86
+ curr_price=curr_prices[self.HIGH_COL],
87
+ struct_price=structure[self.HIGH_COL],
88
+ prev_prices=prev_prices[self.HIGH_COL],
89
+ struct_start=structure[self.HIGH_START_COL],
90
+ i=i,
91
+ direction=structure['direction'],
92
+ target_direction=1
93
+ )
94
+
95
+ is_low_broken = self._check_structure_break(
96
+ curr_price=curr_prices[self.LOW_COL],
97
+ struct_price=structure[self.LOW_COL],
98
+ prev_prices=prev_prices[self.LOW_COL],
99
+ struct_start=structure[self.LOW_START_COL],
100
+ i=i,
101
+ direction=structure['direction'],
102
+ target_direction=2,
103
+ mode=self.LOW_COL
104
+ )
105
+
106
+ if is_low_broken:
107
+ # 处理低点突破
108
+ structure = self._handle_structure_break(
109
+ df, i, structure,
110
+ break_type=self.LOW_COL,
111
+ struct_type='BOS' if structure['direction'] == 1 else 'CHOCH'
112
+ )
113
+
114
+ elif is_high_broken:
115
+ # 处理高点突破
116
+ structure = self._handle_structure_break(
117
+ df, i, structure,
118
+ break_type=self.HIGH_COL,
119
+ struct_type='BOS' if structure['direction'] == 2 else 'CHOCH'
120
+ )
121
+
122
+ else:
123
+ # 更新当前结构
124
+ structure = self._update_current_structure(
125
+ df, i, structure,
126
+ is_struct_body_break=is_struct_body_break
127
+ )
128
+
129
+ # 更新数据框结构列
130
+ self._update_structure_columns(df, i, structure)
131
+
132
+ return df
133
+
134
+ def _get_structure_extreme_bar(self, df, bar_index, struct_index, mode='high'):
135
+ """
136
+ 获取结构最高点或最低点
137
+ :param df: DataFrame数据
138
+ :param bar_index: 当前K线索引
139
+ :param lookback: 回溯周期
140
+ :param mode: self.HIGH_COL寻找最高点,self.LOW_COL寻找最低点
141
+ :return: 结构极值点的索引
142
+ """
143
+ df = df.copy()
144
+ # window_start = max(0, bar_index - lookback + 1)
145
+ window_start = max(0, struct_index)
146
+
147
+ window = df.iloc[window_start : bar_index + 1]
148
+
149
+ # 获取窗口内的极值点索引
150
+ if mode == self.HIGH_COL:
151
+ extremeBar = window[self.HIGH_COL].argmax()
152
+ price_col = self.HIGH_COL
153
+ comp_func = lambda x, y: x > y
154
+ else:
155
+ extremeBar = window[self.LOW_COL].argmin()
156
+ price_col = self.LOW_COL
157
+ comp_func = lambda x, y: x < y
158
+
159
+ # 初始化记录点
160
+ pivot = 0
161
+ # 从后向前遍历寻找结构极值点
162
+ # for i in range(lookback - 1, -1, -1):
163
+ for idx in range(bar_index - 1, struct_index - 1, -1):
164
+ # 计算当前位置的索引
165
+ # idx = bar_index - i
166
+ if idx - 2 < 0 or idx + 1 >= len(df):
167
+ continue
168
+
169
+ price_prev = df[price_col].iloc[idx - 1]
170
+ price_prev2 = df[price_col].iloc[idx - 2]
171
+ price_curr = df[price_col].iloc[idx]
172
+
173
+ # 记录满足条件的点位
174
+ if (comp_func(price_prev, price_prev2) and
175
+ not comp_func(price_curr, price_prev) \
176
+ # and idx - 1 >= extremeBar
177
+ ):
178
+ if pivot == 0:
179
+ pivot = idx - 1
180
+ continue
181
+ else:
182
+ # 比较当前点位与之前记录的极值点的价格,因为在区间内有多个极致点,需要比较
183
+ if comp_func(df[price_col].iloc[idx-1], df[price_col].iloc[pivot]):
184
+ pivot = idx - 1
185
+ if pivot != 0:
186
+ extremeBar = pivot
187
+
188
+ return extremeBar
189
+
190
+ def _check_structure_break(self, curr_price, struct_price, prev_prices, struct_start, i, direction, target_direction, mode='high'):
191
+ """检查结构是否突破"""
192
+ comp = operator.gt if mode == self.HIGH_COL else operator.lt
193
+ reverse_comp = operator.le if mode == self.HIGH_COL else operator.ge
194
+
195
+ basic_break = (
196
+ comp(curr_price, struct_price) and
197
+ all(reverse_comp(p, struct_price) for p in prev_prices) and
198
+ all(i-j > struct_start for j in range(1,4))
199
+ )
200
+
201
+ direction_break = direction == target_direction and comp(curr_price, struct_price)
202
+
203
+ return basic_break or direction_break
204
+
205
+ def _handle_structure_break(self, df, i, structure, break_type, struct_type):
206
+ """处理结构突破"""
207
+ is_high_break = break_type == self.HIGH_COL
208
+
209
+ struct_start = structure[self.HIGH_START_COL] if is_high_break else structure[self.LOW_START_COL]
210
+
211
+ # 获取新的极值点
212
+ extreme_idx = self._get_structure_extreme_bar(
213
+ df, i, struct_start,
214
+ mode=self.LOW_COL if is_high_break else self.HIGH_COL
215
+ )
216
+
217
+ # 更新结构信息
218
+ new_structure = structure.copy()
219
+ new_structure['direction'] = 2 if is_high_break else 1
220
+
221
+ if is_high_break:
222
+ new_structure.update({
223
+ self.LOW_COL: self.toDecimal(df[self.LOW_COL].iloc[extreme_idx]),
224
+ self.HIGH_COL: self.toDecimal(df[self.HIGH_COL].iloc[i]),
225
+ self.LOW_START_COL: extreme_idx,
226
+ self.HIGH_START_COL: i
227
+ })
228
+ else:
229
+ new_structure.update({
230
+ self.HIGH_COL: self.toDecimal(df[self.HIGH_COL].iloc[extreme_idx]),
231
+ self.LOW_COL: self.toDecimal(df[self.LOW_COL].iloc[i]),
232
+ self.HIGH_START_COL: extreme_idx,
233
+ self.LOW_START_COL: i
234
+ })
235
+
236
+ # 更新DataFrame结构信息
237
+ # df.at[i, self.STRUCT_DIRECTION_COL] = new_structure['direction']
238
+ df.at[i, self.STRUCT_DIRECTION_COL] = self.BULLISH_TREND if is_high_break else self.BEARISH_TREND
239
+ df.at[i, self.STRUCT_COL] = f"{self.BULLISH_TREND if is_high_break else self.BEARISH_TREND}_{struct_type}"
240
+
241
+ return new_structure
242
+
243
+ def _update_current_structure(self, df, i, structure, is_struct_body_break):
244
+ """更新当前结构"""
245
+ new_structure = structure.copy()
246
+
247
+ # 检查是否需要更新高点
248
+ if (structure['direction'] in (2,0)) and df.at[i,self.HIGH_COL] > structure[self.HIGH_COL]:
249
+ if not (is_struct_body_break and all(i-j > structure[self.HIGH_START_COL] for j in range(1,4))):
250
+ new_structure[self.HIGH_COL] = df.at[i,self.HIGH_COL]
251
+ new_structure[self.HIGH_START_COL] = i
252
+
253
+ # 检查是否需要更新低点
254
+ elif (structure['direction'] in (1,0)) and df.at[i,self.LOW_COL] < structure[self.LOW_COL]:
255
+ if not (is_struct_body_break and all(i-j > structure[self.LOW_START_COL] for j in range(1,4))):
256
+ new_structure[self.LOW_COL] = df.at[i,self.LOW_COL]
257
+ new_structure[self.LOW_START_COL] = i
258
+
259
+ return new_structure
260
+
261
+ def _update_structure_columns(self, df, i, structure):
262
+ """更新数据框中的结构列"""
263
+ df.at[i, self.STRUCT_HIGH_COL] = self.toDecimal(structure[self.HIGH_COL])
264
+ df.at[i, self.STRUCT_LOW_COL] = self.toDecimal(structure[self.LOW_COL] )
265
+ df.at[i, self.STRUCT_HIGH_INDEX_COL] = structure[self.HIGH_START_COL]
266
+ df.at[i, self.STRUCT_LOW_INDEX_COL] = structure[self.LOW_START_COL]
267
+
268
+ def get_last_struct(self, df):
269
+ """
270
+ 获取最新的结构
271
+ """
272
+ check_columns = [self.STRUCT_COL]
273
+ if not self.check_columns(df, check_columns):
274
+ data = self.build_struct(df=df)
275
+ else:
276
+ data = df.copy()
277
+
278
+ # 筛选有效结构且在prd范围内的数据
279
+ last_struct = None
280
+ mask = data[self.STRUCT_COL].notna()
281
+ valid_structs = data[ mask ]
282
+ if not valid_structs.empty:
283
+ # 获取最近的结构
284
+ last_struct = valid_structs.iloc[-1]
285
+ return {
286
+ self.STRUCT_COL: last_struct[self.STRUCT_COL],
287
+ self.STRUCT_HIGH_COL: last_struct[self.STRUCT_HIGH_COL],
288
+ self.STRUCT_LOW_COL: last_struct[self.STRUCT_LOW_COL],
289
+ self.STRUCT_MID_COL: (last_struct[self.STRUCT_HIGH_COL] + last_struct[self.STRUCT_LOW_COL]) / 2,
290
+ self.STRUCT_HIGH_INDEX_COL: last_struct[self.STRUCT_HIGH_INDEX_COL],
291
+ self.STRUCT_LOW_INDEX_COL: last_struct[self.STRUCT_LOW_INDEX_COL],
292
+ self.STRUCT_DIRECTION_COL: last_struct[self.STRUCT_DIRECTION_COL]
293
+ }
294
+
295
+ return last_struct
296
+
core/smc/__init__.py ADDED
File without changes
core/utils/OPTools.py ADDED
@@ -0,0 +1,30 @@
1
+ import requests
2
+ from decimal import Decimal
3
+
4
+ class OPTools:
5
+
6
+ @staticmethod
7
+ def toDecimal(value, precision:int=None):
8
+ """将数值转换为Decimal类型
9
+
10
+ Args:
11
+ value: 需要转换的数值
12
+ precision: 精度,如果不指定则保持原始精度
13
+
14
+ Returns:
15
+ Decimal: 转换后的Decimal对象
16
+ """
17
+ if precision is None:
18
+ return Decimal(str(value))
19
+ return Decimal(f"{value:.{precision}f}")
20
+
21
+ @staticmethod
22
+ def send_feishu_notification(webhook, message):
23
+ if webhook:
24
+ headers = {'Content-Type': 'application/json'}
25
+ data = {"msg_type": "text", "content": {"text": message}}
26
+ response = requests.post(webhook, headers=headers, json=data)
27
+ if response.status_code != 200:
28
+ # self.logger.debug("飞书通知发送成功")
29
+ raise Exception(f"飞书通知发送失败: {response.text} {webhook}")
30
+
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.3
2
+ Name: openfund-core
3
+ Version: 1.0.5
4
+ Summary: Openfund-core.
5
+ Requires-Python: >=3.9,<4.0
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3.9
8
+ Classifier: Programming Language :: Python :: 3.10
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Requires-Dist: apscheduler (>=3.11.0,<4.0.0)
13
+ Requires-Dist: ccxt (>=4.4.26,<5.0.0)
14
+ Requires-Dist: pandas (>=2.2.3,<3.0.0)
15
+ Requires-Dist: pyfiglet (>=1.0.2,<2.0.0)
16
+ Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
17
+ Description-Content-Type: text/markdown
18
+
19
+ # jiezhen
20
+ ## 读秒循环接针
21
+ **视频说明地址** :https://www.youtube.com/watch?v=b-LhdQomOxk
22
+
23
+ **环境**:`python3.9`
24
+ **开平仓模式** ,不支持单向持仓
25
+ **策略原理** :上次在火币看到一些很长的针,就想着如何把针接住,本质很简单,
26
+ 1. 用ema判断短期趋势,尽可能下面挂单接住插下来的针。
27
+ 2. 如果跑15m周期以上,建议用1h的ema判断多空,或者人工介入判断
28
+
29
+ **源码配置** :
30
+ config_bak.json 改成config.json
31
+
32
+ #### apiKey: OKX API 的公钥,用于身份验证。
33
+ #### secret: OKX API 的私钥,用于签名请求。
34
+ #### password: OKX 的交易密码(或 API 密码)。
35
+ #### leverage: 默认持仓杠杆倍数
36
+ #### feishu_webhook: 飞书通知地址
37
+ #### monitor_interval: 循环间隔周期 / 单位秒
38
+
39
+
40
+ ## 每个交易对都可以单独设置其交易参数:
41
+ #### long_amount_usdt: 做多交易时每笔订单分配的资金量(以 USDT 为单位)。
42
+ #### short_amount_usdt: 做空交易时每笔订单分配的资金量(以 USDT 为单位)。
43
+ #### value_multiplier: 用于放大交易价值的乘数,适合调整风险/回报比。
44
+
45
+ zhen.py 跟 zhen_2.py 的区别是:https://x.com/huojichuanqi/status/1858991226877603902
46
+
47
+ 打赏地址trc20: TUunBuqQ1ZDYt9WrA3ZarndFPQgefXqZAM
48
+
@@ -0,0 +1,15 @@
1
+ core/Exchange.py,sha256=eanGV-8ZLDFxP2tV6xumo8c68yqFTUeseJA_dHMhYb0,20785
2
+ core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ core/main.py,sha256=E-VZzem7-0_J6EmOo9blLPokc5MRcgjqCbqAvbkPnWI,630
4
+ core/smc/SMCBase.py,sha256=epRC5bWDymx7ZMIhn_bVJRjvBHItt6BCnYASO2fhSDg,4302
5
+ core/smc/SMCFVG.py,sha256=QtqlW1oooYVA7CG5ld5X0Q5twX1XCELO118IlMUhX6M,2974
6
+ core/smc/SMCLiquidity.py,sha256=lZt2IQk3TWaT-nA7he57dUxPdLEWW61jRZWLAzOTat0,119
7
+ core/smc/SMCOrderBlock.py,sha256=Il5JKmVER2vT6AKZLo0mD4wRqV_Op9IBK3jB1SfgTqY,9894
8
+ core/smc/SMCPDArray.py,sha256=Vn_nTBLaIhrBhxe_hX3Iycn0gY0tmYd_qaqNalztfmA,2841
9
+ core/smc/SMCStruct.py,sha256=FZoh_F81YvONZObbDF7jzH8F6lDgo0-17tNQwOS3V_g,12260
10
+ core/smc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ core/utils/OPTools.py,sha256=tJ1Jq_Caab6OWaX12xn4_g9ryf98Rm5I1zsJEEU8NIQ,1002
12
+ openfund_core-1.0.5.dist-info/METADATA,sha256=VZWu0jgtwFtrr5fqdgk3p28GZWGwoMQeNNHwFj5QHsk,1953
13
+ openfund_core-1.0.5.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
14
+ openfund_core-1.0.5.dist-info/entry_points.txt,sha256=g8GUw3cyKFtcG5VWs8geU5VBLqiWr59GElqERuH8zD0,48
15
+ openfund_core-1.0.5.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.0.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ openfund-core=core.main:main
3
+
openfund/core/__init__.py DELETED
@@ -1,14 +0,0 @@
1
- # import time
2
- # from apscheduler.schedulers.blocking import BlockingScheduler
3
-
4
-
5
- # def taskDetail(taskName: str):
6
- # currTime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
7
- # print(f"{taskName}-->", "currTime:", currTime)
8
-
9
-
10
- # if __name__ == "__main__":
11
- # apSchedule = BlockingScheduler()
12
- # apSchedule.add_job(func=taskDetail, trigger="interval", seconds=5, args=["task-A"])
13
-
14
- # apSchedule.start()
@@ -1,16 +0,0 @@
1
- # from binance.spot import Spot
2
-
3
- # client = Spot()
4
-
5
- # Get server timestamp
6
- # print(client.time())
7
- # Get klines of BTCUSDT at 1m interval
8
- # print(client.klines("BTCUSDT", "1m"))
9
- # Get last 10 klines of BNBUSDT at 1h interval
10
- # print(client.klines("BNBUSDT", "1h", limit=10))
11
-
12
- # API key/secret are required for user data endpoints
13
- # client = Spot(api_key='<api_key>', api_secret='<api_secret>')
14
-
15
- # Get account and balance information
16
- # print(client.account())
@@ -1,23 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import logging
4
-
5
- from openfund.core.base_tool import Tool as BaseTool
6
- from openfund.core.pyopenfund import Openfund
7
-
8
-
9
- logger = logging.getLogger(__name__)
10
-
11
-
12
- class BinanceUMFuturesTool(BaseTool):
13
- def __init__(self, openfund: Openfund | None = None) -> None:
14
- super().__init__(openfund, "binance")
15
-
16
- def time(self):
17
- return self.umclient.time()
18
-
19
- def ping(self):
20
- return self.umclient.ping()
21
-
22
- def klines(self, symbol: str, interval: str = "1m", **kwargs):
23
- return self.umclient.klines(symbol=symbol, interval=interval, **kwargs)
@@ -1,26 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import logging
4
- from poetry.utils.authenticator import Authenticator
5
-
6
- from typing import TYPE_CHECKING
7
-
8
- from openfund.core.base_tool import Tool as BaseTool
9
- from openfund.core.pyopenfund import Openfund
10
-
11
-
12
- logger = logging.getLogger(__name__)
13
-
14
-
15
- class BinanceTools(BaseTool):
16
- def __init__(self, openfund: Openfund | None = None) -> None:
17
- super().__init__(openfund, "binance")
18
-
19
- def get_time(self):
20
- return self.client.time()
21
-
22
- def get_account(self):
23
- return self.client.account()
24
-
25
- def get_klines(self, symbol: str, interval: str, **kwargs):
26
- return self.client.klines(symbol=symbol, interval=interval, **kwargs)