xync-client 0.0.141__py3-none-any.whl → 0.0.156.dev18__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 (40) hide show
  1. xync_client/Abc/AdLoader.py +5 -0
  2. xync_client/Abc/Agent.py +354 -8
  3. xync_client/Abc/Ex.py +432 -25
  4. xync_client/Abc/HasAbotUid.py +10 -0
  5. xync_client/Abc/InAgent.py +0 -11
  6. xync_client/Abc/PmAgent.py +34 -26
  7. xync_client/Abc/xtype.py +57 -3
  8. xync_client/Bybit/InAgent.py +233 -409
  9. xync_client/Bybit/agent.py +844 -777
  10. xync_client/Bybit/etype/__init__.py +0 -0
  11. xync_client/Bybit/etype/ad.py +54 -86
  12. xync_client/Bybit/etype/cred.py +29 -9
  13. xync_client/Bybit/etype/order.py +75 -103
  14. xync_client/Bybit/ex.py +35 -48
  15. xync_client/Gmail/__init__.py +119 -98
  16. xync_client/Htx/agent.py +213 -40
  17. xync_client/Htx/etype/ad.py +40 -16
  18. xync_client/Htx/etype/order.py +194 -0
  19. xync_client/Htx/ex.py +17 -19
  20. xync_client/Mexc/agent.py +268 -0
  21. xync_client/Mexc/api.py +1255 -0
  22. xync_client/Mexc/etype/ad.py +52 -1
  23. xync_client/Mexc/etype/order.py +354 -0
  24. xync_client/Mexc/ex.py +34 -22
  25. xync_client/Okx/1.py +14 -0
  26. xync_client/Okx/agent.py +39 -0
  27. xync_client/Okx/ex.py +8 -8
  28. xync_client/Pms/Payeer/agent.py +396 -0
  29. xync_client/Pms/Payeer/login.py +1 -59
  30. xync_client/Pms/Payeer/trade.py +58 -0
  31. xync_client/Pms/Volet/__init__.py +82 -63
  32. xync_client/Pms/Volet/api.py +5 -4
  33. xync_client/loader.py +2 -0
  34. xync_client/pm_unifier.py +1 -1
  35. {xync_client-0.0.141.dist-info → xync_client-0.0.156.dev18.dist-info}/METADATA +5 -1
  36. {xync_client-0.0.141.dist-info → xync_client-0.0.156.dev18.dist-info}/RECORD +38 -29
  37. xync_client/Pms/Payeer/__init__.py +0 -253
  38. xync_client/Pms/Payeer/api.py +0 -25
  39. {xync_client-0.0.141.dist-info → xync_client-0.0.156.dev18.dist-info}/WHEEL +0 -0
  40. {xync_client-0.0.141.dist-info → xync_client-0.0.156.dev18.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  from pydantic import BaseModel, Field
2
2
  from xync_schema.xtype import BaseAd
3
- from typing import Optional
3
+ from typing import Optional, Literal
4
4
 
5
5
 
6
6
  class Merchant(BaseModel):
@@ -30,6 +30,23 @@ class MerchantStatistics(BaseModel):
30
30
  avgSellHandleTime: float
31
31
 
32
32
 
33
+ class AdsReq(BaseModel):
34
+ coinId: str # hex
35
+ currency: str # hex
36
+ tradeType: Literal["SELL", "BUY"]
37
+
38
+ payMethod: str = "" # int,int
39
+ amount: str = "" # int
40
+ page: int = 1
41
+
42
+ blockTrade: str = "false" # bool
43
+ # countryCode: str = ""
44
+ follow: str = "false"
45
+ haveTrade: str = "false"
46
+ adsType: int = 1
47
+ allowTrade: str = "false"
48
+
49
+
33
50
  class Ad(BaseAd):
34
51
  exid: str | None = Field(alias="id")
35
52
  price: float
@@ -57,3 +74,37 @@ class Ad(BaseAd):
57
74
  minRegisterDate: int
58
75
  blockTrade: bool
59
76
  tags: str
77
+
78
+
79
+ class AdUpd(BaseAd):
80
+ id: str
81
+ price: float
82
+ coinId: str # hex
83
+ currency: str
84
+ tradeType: Literal["SELL", "BUY"]
85
+ payment: str
86
+ minTradeLimit: float
87
+ quantity: float
88
+ maxTradeLimit: float
89
+ deviceId: str
90
+ autoResponse: str = "" # quote("P1132998804")
91
+
92
+ tradeTerms: str = ""
93
+ priceType: int = 0
94
+
95
+ adsType: int = 1
96
+ allowSys: str = "true" # bool
97
+ apiVersion: str = "1.0.0"
98
+ authVersion: str = "v2"
99
+ blockTrade: str = "false"
100
+ countryCode: str = "RU"
101
+ display: int = 1 # bool
102
+ exchangeCount: int = 0
103
+ expirationTime: int = 15
104
+ fiatCount: int = 0
105
+ fiatCountLess: int = 0
106
+ kycLevel: Literal["PRIMARY"] = "PRIMARY"
107
+ maxPayLimit: int = 0
108
+ minRegisterDate: int = 0
109
+ requireMobile: str = "false" # bool
110
+ securityOrderPaymentInfo: str = ""
@@ -0,0 +1,354 @@
1
+ from enum import IntEnum
2
+ from typing import Optional, Literal
3
+
4
+ from pydantic import BaseModel, Field
5
+
6
+ # ============ Enums ============
7
+ Side = Literal["BUY", "SELL"]
8
+
9
+
10
+ class AdvStatus(IntEnum):
11
+ CLOSE = 0
12
+ OPEN = 1
13
+ DELETE = 2
14
+ LOW_STOCK = 3
15
+
16
+
17
+ class OrderDealState(IntEnum):
18
+ NOT_PAID = 0
19
+ PAID = 1
20
+ WAIT_PROCESS = 2
21
+ PROCESSING = 3
22
+ DONE = 4
23
+ CANCEL = 5
24
+ INVALID = 6
25
+ REFUSE = 7
26
+ TIMEOUT = 8
27
+
28
+
29
+ class NotifyType(IntEnum):
30
+ SMS = 0
31
+ MAIL = 1
32
+ GA = 2
33
+
34
+
35
+ # ============ Request Models ============
36
+ class CreateUpdateAdRequest(BaseModel):
37
+ advNo: Optional[str] = None
38
+ payTimeLimit: int
39
+ initQuantity: float
40
+ supplyQuantity: Optional[float] = None
41
+ price: float
42
+ coinId: str
43
+ countryCode: Optional[str] = None
44
+ side: str
45
+ advStatus: Optional[str] = None
46
+ allowSys: Optional[bool] = None
47
+ fiatUnit: str
48
+ payMethod: str
49
+ autoReplyMsg: Optional[str] = None
50
+ tradeTerms: Optional[str] = None
51
+ minSingleTransAmount: float
52
+ maxSingleTransAmount: float
53
+ kycLevel: Optional[str] = None
54
+ requireMobile: Optional[bool] = None
55
+ userAllTradeCountMin: int
56
+ userAllTradeCountMax: int
57
+ exchangeCount: Optional[int] = None
58
+ maxPayLimit: Optional[int] = None
59
+ buyerRegDaysLimit: Optional[int] = None
60
+ creditAmount: Optional[float] = None
61
+ blockTrade: Optional[bool] = None
62
+ deviceId: Optional[str] = None
63
+
64
+
65
+ class CreateOrderRequest(BaseModel):
66
+ advNo: str
67
+ amount: Optional[float] = None
68
+ tradableQuantity: Optional[float] = None
69
+ userConfirmPaymentId: int
70
+ userConfirmPayMethodId: Optional[int] = None
71
+ deviceId: Optional[str] = None
72
+
73
+
74
+ class ConfirmPaidRequest(BaseModel):
75
+ advOrderNo: str
76
+ payId: int
77
+
78
+
79
+ class ReleaseCoinRequest(BaseModel):
80
+ advOrderNo: str
81
+ notifyType: Optional[str] = None
82
+ notifyCode: Optional[str] = None
83
+
84
+
85
+ class ServiceSwitchRequest(BaseModel):
86
+ open: bool
87
+
88
+
89
+ # ============ Response Models ============
90
+ class BaseResponse(BaseModel):
91
+ code: int
92
+ msg: str
93
+
94
+
95
+ class PaymentInfo(BaseModel):
96
+ id: int
97
+ payMethod: int
98
+ bankName: str = None
99
+ account: str = None
100
+ bankAddress: str = None
101
+ payee: str = None
102
+ extend: str = None
103
+
104
+
105
+ class MerchantInfo(BaseModel):
106
+ nickName: str
107
+ imId: str
108
+ memberId: str
109
+ registry: int
110
+ vipLevel: int
111
+ greenDiamond: bool
112
+ emailAuthentication: bool
113
+ smsAuthentication: bool
114
+ identityVerification: bool
115
+ lastOnlineTime: int
116
+ badge: str
117
+ merchantType: str
118
+
119
+
120
+ class MerchantStatistics(BaseModel):
121
+ totalBuyCount: int
122
+ totalSellCount: int
123
+ doneLastMonthCount: int
124
+ avgBuyHandleTime: float
125
+ avgSellHandleTime: float
126
+ lastMonthCompleteRate: str
127
+ completeRate: str
128
+ avgHandleTime: float
129
+
130
+
131
+ 2
132
+
133
+
134
+ class Advertisement(BaseModel):
135
+ advNo: str
136
+ payTimeLimit: int
137
+ quantity: int = None
138
+ price: float
139
+ initAmount: float = None
140
+ frozenQuantity: float = None
141
+ availableQuantity: float
142
+ coinId: str = None
143
+ coinName: str
144
+ countryCode: str
145
+ commissionRate: float = None
146
+ advStatus: str = None
147
+ side: str
148
+ createTime: int = None
149
+ updateTime: int
150
+ fiatUnit: str
151
+ feeType: int = None
152
+ autoReplyMsg: str
153
+ tradeTerms: str
154
+ payMethod: str
155
+ paymentInfo: list[PaymentInfo]
156
+ minSingleTransAmount: float
157
+ maxSingleTransAmount: float
158
+ kycLevel: Literal["PRIMARY", "ADVANCED"]
159
+ requireMobile: bool
160
+ userAllTradeCountMax: int
161
+ userAllTradeCountMin: int
162
+ exchangeCount: int
163
+ maxPayLimit: int
164
+ buyerRegDaysLimit: int
165
+ blockTrade: bool
166
+
167
+
168
+ class MarketAdvertisement(Advertisement):
169
+ merchant: MerchantInfo
170
+ merchantStatistics: MerchantStatistics
171
+ orderPayCount: int
172
+ tags: str
173
+
174
+
175
+ class PageInfo(BaseModel):
176
+ total: int
177
+ currPage: int
178
+ pageSize: int
179
+ totalPage: int
180
+
181
+
182
+ class UserInfo(BaseModel):
183
+ nickName: str
184
+
185
+
186
+ class Order(BaseModel):
187
+ advNo: str
188
+ advOrderNo: str
189
+ tradableQuantity: float
190
+ price: float
191
+ amount: float
192
+ coinName: str
193
+ state: Literal["DONE", "PAID", "NOT_PAID", "PROCESSING"]
194
+ payTimeLimit: int
195
+ side: Side
196
+ fiatUnit: str
197
+ createTime: int
198
+ updateTime: int
199
+ userInfo: UserInfo
200
+ complained: bool
201
+ blockUser: bool = None
202
+ unreadCount: int
203
+ complainId: Optional[str] = None
204
+
205
+
206
+ class OrderDetail(Order):
207
+ paymentInfo: list[PaymentInfo]
208
+ allowComplainTime: int = None
209
+ confirmPaymentInfo: PaymentInfo
210
+ userInfo: dict
211
+ userFiatStatistics: dict = None
212
+ spotCount: int = None
213
+
214
+
215
+ class CreateAdResponse(BaseResponse):
216
+ data: str # advNo
217
+
218
+
219
+ class AdListResponse(BaseResponse):
220
+ data: list[Advertisement]
221
+ page: PageInfo
222
+
223
+
224
+ class MarketAdListResponse(BaseResponse):
225
+ data: list[MarketAdvertisement]
226
+ page: PageInfo
227
+
228
+
229
+ class CreateOrderResponse(BaseResponse):
230
+ data: str # advOrderNo
231
+
232
+
233
+ class OrderListResponse(BaseResponse):
234
+ data: list[Order]
235
+ page: PageInfo
236
+
237
+
238
+ class OrderDetailResponse(BaseResponse):
239
+ data: OrderDetail
240
+
241
+
242
+ class ListenKeyResponse(BaseModel):
243
+ listenKey: str
244
+
245
+
246
+ class ConversationResponse(BaseResponse):
247
+ data: dict
248
+
249
+
250
+ class ChatMessage(BaseModel):
251
+ id: int
252
+ content: Optional[str] = None
253
+ createTime: str
254
+ fromNickName: str
255
+ fromUserId: str
256
+ type: int
257
+ imageUrl: Optional[str] = None
258
+ imageThumbUrl: Optional[str] = None
259
+ videoUrl: Optional[str] = None
260
+ fileUrl: Optional[str] = None
261
+ self_: bool = Field(alias="self")
262
+ conversationId: int
263
+
264
+
265
+ class ChatMessagesResponse(BaseResponse):
266
+ data: dict
267
+
268
+
269
+ class UploadFileResponse(BaseResponse):
270
+ data: dict
271
+
272
+
273
+ # ============ WebSocket Message Models ============
274
+ class ChatMessageType(IntEnum):
275
+ TEXT = 1
276
+ IMAGE = 2
277
+ VIDEO = 3
278
+ FILE = 4
279
+
280
+
281
+ class WSMethod(str):
282
+ SUBSCRIPTION = "SUBSCRIPTION"
283
+ UNSUBSCRIPTION = "UNSUBSCRIPTION"
284
+ SEND_MESSAGE = "SEND_MESSAGE"
285
+ RECEIVE_MESSAGE = "RECEIVE_MESSAGE"
286
+ PING = "PING"
287
+
288
+
289
+ class SendTextMessage(BaseModel):
290
+ """Отправка текстового сообщения"""
291
+
292
+ content: str
293
+ conversationId: int
294
+ type: int = ChatMessageType.TEXT
295
+
296
+
297
+ class SendImageMessage(BaseModel):
298
+ """Отправка изображения"""
299
+
300
+ imageUrl: str
301
+ imageThumbUrl: str
302
+ conversationId: int
303
+ type: int = ChatMessageType.IMAGE
304
+
305
+
306
+ class SendVideoMessage(BaseModel):
307
+ """Отправка видео"""
308
+
309
+ videoUrl: str
310
+ imageThumbUrl: str # превью видео
311
+ conversationId: int
312
+ type: int = ChatMessageType.VIDEO
313
+
314
+
315
+ class SendFileMessage(BaseModel):
316
+ """Отправка файла"""
317
+
318
+ fileUrl: str
319
+ conversationId: int
320
+ type: int = ChatMessageType.FILE
321
+
322
+
323
+ class WSRequest(BaseModel):
324
+ """Базовая структура WebSocket запроса"""
325
+
326
+ method: str
327
+ params: dict | list[str] | None = None
328
+ id: int = None
329
+
330
+
331
+ class WSBaseResponse(BaseModel):
332
+ """Базовый ответ WebSocket"""
333
+
334
+ success: bool
335
+ method: str
336
+ msg: str
337
+ data: Optional[str] = None
338
+
339
+
340
+ class ReceivedChatMessage(BaseModel):
341
+ """Полученное сообщение из чата"""
342
+
343
+ id: int
344
+ content: Optional[str] = None
345
+ conversationId: int
346
+ type: int
347
+ imageUrl: Optional[str] = None
348
+ imageThumbUrl: Optional[str] = None
349
+ videoUrl: Optional[str] = None
350
+ fileUrl: Optional[str] = None
351
+ createTime: str
352
+ self_: bool = Field(alias="self")
353
+ fromUserId: str
354
+ fromNickName: str
xync_client/Mexc/ex.py CHANGED
@@ -6,7 +6,7 @@ import requests
6
6
  from xync_client.loader import TORM, NET_TOKEN
7
7
 
8
8
  from xync_client.Abc.Ex import BaseExClient
9
- from xync_client.Abc.xtype import PmEx, MapOfIdsList
9
+ from xync_client.Abc.xtype import PmEx, MapOfIdsList, GetAds
10
10
  from xync_client.Mexc.etype import pm, ad
11
11
 
12
12
  from xync_schema import xtype
@@ -66,42 +66,54 @@ class ExClient(BaseExClient):
66
66
  p = {cur: {c for c in coins} for cur in curs}
67
67
  return p, p
68
68
 
69
+ async def x2e_pm(self, xid: int, cur_id: int = None) -> str: # pmex.exid
70
+ if not self.pm_x2e.get(xid):
71
+ fltr = dict(pm_id=xid, ex=self.ex)
72
+ if cur_id:
73
+ cur = await models.Cur[cur_id]
74
+ pmexs = await models.PmEx.filter(**fltr)
75
+ self.pm_x2e[xid] = [pmex.exid for pmex in pmexs if pmex.name.endswith(f"({cur.ticker})")][0]
76
+ else:
77
+ self.pm_x2e[xid] = (await models.PmEx.get(**fltr)).exid
78
+ return self.pm_x2e[xid]
79
+
80
+ async def x2e_req_ads(self, xreq: GetAds) -> ad.AdsReq:
81
+ coin_id, _ = await self.x2e_coin(xreq.coin_id)
82
+ cur_id, _, __ = await self.x2e_cur(xreq.cur_id)
83
+ ereq = ad.AdsReq(
84
+ coinId=coin_id,
85
+ currency=cur_id,
86
+ tradeType="SELL" if xreq.is_sell else "BUY",
87
+ payMethod=",".join([await self.x2e_pm(pm_id, cur_id=xreq.cur_id) for pm_id in xreq.pm_ids]),
88
+ )
89
+ if xreq.amount:
90
+ ereq.amount = str(xreq.amount)
91
+ # todo: all kwargs
92
+ return ereq
93
+
69
94
  # 24: Список объяв по (buy/sell, cur, coin, pm)
70
- async def ads(
71
- self, coin_exid: str, cur_exid: str, is_sell: bool, pm_exids: list[str | int] = None, amount: int = None
95
+ async def _ads(
96
+ self, req: ad.AdsReq, lim: int = None, vm_filter: bool = False, **kwargs
72
97
  ) -> list[ad.Ad]: # {ad.id: ad}
73
- params = {
74
- "allowTrade": "false",
75
- "amount": amount or "",
76
- "blockTrade": "false",
77
- "coinId": coin_exid,
78
- "countryCode": "",
79
- "currency": cur_exid,
80
- "follow": "false",
81
- "haveTrade": "false",
82
- "page": "1",
83
- "payMethod": pm_exids or "",
84
- "tradeType": "SELL" if is_sell else "BUY",
85
- }
86
-
87
- ads = requests.get("https://p2p.mexc.com/api/market", params=params).json()
88
- return [ad.Ad(**_ad) for _ad in ads["data"]]
98
+ resp = requests.get("https://p2p.mexc.com/api/market", params=req.model_dump())
99
+ return [ad.Ad(**_ad) for _ad in resp.json()["data"]]
89
100
 
90
101
 
91
102
  async def main():
92
103
  _ = await init_db(TORM)
93
104
  async with FileClient(NET_TOKEN) as b:
94
105
  ex = await Ex.get(name="Mexc")
95
- cl = ex.client(b)
106
+ cl: ExClient = ex.client(b)
96
107
  # await ex.curexs.filter(cur__ticker="EUR")
97
108
  # await cl.set_pms()
98
109
  # await cl.set_coinexs()
99
- _ads = await cl.ads("USDT", "EUR", True)
110
+ coinex = await models.CoinEx.get(ex=cl.ex, coin_id=1)
111
+ _ads = await cl.ads(coinex.exid, "RUB", True, ["5"])
100
112
  _cr = await cl.curs()
101
113
  _cn = await cl.coins()
102
114
  await cl.set_pairs()
103
115
  _pms = await cl.pms()
104
- await cl.close()
116
+ await cl.stop()
105
117
 
106
118
 
107
119
  if __name__ == "__main__":
xync_client/Okx/1.py ADDED
@@ -0,0 +1,14 @@
1
+ import requests
2
+
3
+
4
+ headers = {
5
+ "authorization": "eyJraWQiOiIxMzYzODYiLCJhbGciOiJFUzI1NiJ9.eyJqdGkiOiJleDExMDE3NjUwMzE1NDY2MjE4NUU3RUJGMUYyRDFFRTE5MW1ka2IiLCJ1aWQiOiI2T3hmUi9aWGkrZkI0YlVUajRNLzh3PT0iLCJzdGEiOjAsIm1pZCI6IjZPeGZSL1pYaStmQjRiVVRqNE0vOHc9PSIsInBpZCI6IlBUeUE4VzA5ekZVSkJHSjZZUk5HWXc9PSIsIm5kZSI6MCwiaWF0IjoxNzY1MjA0NDE4LCJleHAiOjE3NjY0MTQwMTgsImJpZCI6MCwiZG9tIjoid3d3Lm9reC5jb20iLCJlaWQiOjE4LCJpc3MiOiJva2NvaW4iLCJkaWQiOiJ0OFlKbUFXMTNGeWZpMUZhUUhtQVFNSThNZElmYm44NnFPSnpNZFA3VVhhZFFDcFdQSkQ0NWs0ckMrMk1SWjJXIiwiZmlkIjoidDhZSm1BVzEzRnlmaTFGYVFIbUFRTUk4TWRJZmJuODZxT0p6TWRQN1VYYWRRQ3BXUEpENDVrNHJDKzJNUloyVyIsImxpZCI6IjZPeGZSL1pYaStmQjRiVVRqNE0vOHc9PSIsInVmYiI6IlBUeUE4VzA5ekZVSkJHSjZZUk5HWXc9PSIsInVwYiI6ImlCcmEyVmhOb2t5UmloeGlKLzN6RXc9PSIsImt5YyI6Miwia3lpIjoicHFHRVBYWHN6V1ZVNXhRR1NiNURYTGRUcENaS2c1LzZLbjFteGFpclpDbmovbGJBUGxqRlMwbU5qWGxlYXJ6Rjd5ZEYvWU5DR1FXLzV5aTRWQnpUM1E9PSIsImNwayI6ImhCdjNtSEZjb0lETG5TckZ6dEdTTlpMT29aU2s1bUE4SHBQcE9MOFE1TlVYamowc2w5OG9FK2dRWTRsSUdvbm5QUzJwZ0pQckw4ZGNyMlk4N3VEcjYyd0ExK1ZuRmUyUm10a2RCMFYzY3pVVEI2U09sMCtTQjdnQVJvbHdyeHMza1hvVEdua3BvWEVKamdsL2Q0bEN0aUxuUy9ydGRjY1pnZ0hpeEZhclBxWT0iLCJ2ZXIiOjEsImNsdCI6MiwidXVkIjoiV3VoZlhzRHRicG1GNXN3Q25pKzYrWVhUN2FodmJLWnRYZXZlUXNMVHI4az0iLCJzdWIiOiJBODI1QzI4OTI4QzZCRTNFMTlFREFFRUI1ODhEQTVEQiJ9.I1fFTnP7xYaK1s0jCU01NkjyBgk04dBMp7qFahIzmRUn3e34W6mSNDNSWmi-UIhxH2ORbqbhG2ErUSrrsvai3w",
6
+ }
7
+
8
+ response = requests.get("https://www.okx.com/v3/c2c/receiptAccounts", headers=headers)
9
+
10
+ itm = {
11
+ el["type"]: next((field["value"] for field in el.get("fields") if field.get("key") == "accountNo"))
12
+ for el in response.json()["data"]
13
+ }
14
+ print(itm)
@@ -0,0 +1,39 @@
1
+ from pyro_client.client.file import FileClient
2
+ from xync_bot import XyncBot
3
+
4
+ from xync_client.Abc.Agent import BaseAgentClient
5
+ from asyncio import run
6
+ from x_model import init_db
7
+ from xync_schema.models import Agent, Ex
8
+
9
+ from xync_client.Okx.ex import ExClient
10
+ from xync_client.loader import NET_TOKEN, PAY_TOKEN
11
+
12
+
13
+ class AgentClient(BaseAgentClient):
14
+ async def my_fiats(self):
15
+ response = await self._get("/v3/c2c/receiptAccounts")
16
+ fiats = response["data"]
17
+ return {
18
+ fiat["type"]: field["value"] for fiat in fiats for field in fiat["fields"] if field["key"] == "accountNo"
19
+ }
20
+
21
+
22
+ async def main():
23
+ from xync_client.loader import TORM
24
+
25
+ cn = await init_db(TORM)
26
+ ex = await Ex.get(name="Okx")
27
+ agent = await Agent.get(actor__ex=ex).prefetch_related("actor__ex", "actor__person__user__gmail")
28
+ fbot = FileClient(NET_TOKEN)
29
+ ecl: ExClient = ex.client(fbot)
30
+ abot = XyncBot(PAY_TOKEN, cn)
31
+ cl = agent.client(ecl, fbot, abot)
32
+
33
+ _fiats = await cl.my_fiats()
34
+
35
+ await cl.stop()
36
+
37
+
38
+ if __name__ == "__main__":
39
+ run(main())
xync_client/Okx/ex.py CHANGED
@@ -1,7 +1,7 @@
1
1
  from asyncio import run
2
2
 
3
3
  from pyro_client.client.file import FileClient
4
- from pyro_client.loader import NET_TOKEN
4
+ from xync_client.loader import NET_TOKEN
5
5
  from x_model import init_db
6
6
 
7
7
  from xync_client.Abc.Exception import NoPairOnEx
@@ -20,16 +20,16 @@ class ExClient(BaseExClient):
20
20
  "quoteCurrency": cur,
21
21
  "needField": "false",
22
22
  }
23
- pms = await self._get("/v3/c2c/configs/receipt/templates", params=params)
23
+ pms = await self._get(url="/v3/c2c/configs/receipt/templates", params=params)
24
24
  return [pm.PmE(**_pm) for _pm in pms["data"] if _pm["paymentMethod"]]
25
25
 
26
26
  # 19: Список поддерживаемых валют тейкера
27
- async def curs(self) -> dict[int, xtype.CurEx]: # {cur.exid: cur.ticker}
28
- curs = await self._get("/v3/users/common/list/currencies")
29
- return {
30
- cur["displayName"]: xtype.CurEx(exid=cur["displayName"], ticker=cur["displayName"], scale=cur["precision"])
31
- for cur in curs["data"]
32
- }
27
+ # async def curs(self) -> dict[int, xtype.CurEx]: # {cur.exid: cur.ticker}
28
+ # curs = await self._get("/v3/users/common/list/currencies")
29
+ # return {
30
+ # cur["displayName"]: xtype.CurEx(exid=cur["displayName"], ticker=cur["displayName"], scale=cur["precision"])
31
+ # for cur in curs["data"]
32
+ # }
33
33
 
34
34
  # 20: Список платежных методов
35
35
  async def pms(self, cur: models.Cur = None) -> dict[int | str, PmEx]: # {pm.exid: pm}