Skip to content

Commit f8ba6cc

Browse files
committed
pushback
1 parent e24531f commit f8ba6cc

File tree

289 files changed

+75530
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

289 files changed

+75530
-2
lines changed

README.md

Lines changed: 527 additions & 0 deletions
Large diffs are not rendered by default.

build/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"scripts": {
77
"build-single-exchange": "tsx build.ts",
88
"pypi-packager": "tsx pypi-packager.ts",
9-
109
"sample-generate": "cd ../.github/scripts/ && bash generate-exchange-skeleton.sh ../../../tmp_folder kucoin",
1110
"sample-build": "cd ../../tmp_folder/build && npm run build-single-exchange",
1211
"sample-pypi": "cd ../../tmp_folder/build && npm run pypi-packager",
@@ -17,7 +16,8 @@
1716
"dependencies": {
1817
"fs": "*",
1918
"path": "*",
20-
"semver": "^7.7.1"
19+
"semver": "^7.7.1",
20+
"typescript": "^5.8.3"
2121
},
2222
"devDependencies": {
2323
"tsx": "^4.19.3"

examples/async.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import os
2+
import sys
3+
import asyncio
4+
5+
# if CCXT is included locally
6+
# sys.path.append(os.path.dirname(os.path.dirname((os.path.abspath(__file__)))) + '/')
7+
8+
from gate import GateAsync
9+
10+
if sys.platform == 'win32':
11+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
12+
13+
async def main():
14+
instance = GateAsync({})
15+
await instance.load_markets()
16+
symbol = "BTC/USDC"
17+
18+
# fetch ticker
19+
ticker = await instance.fetch_ticker(symbol)
20+
print(ticker)
21+
22+
# create order
23+
order = await instance.create_order("BTC/USDC", "limit", "buy", 1, 123456.789)
24+
print(order)
25+
26+
# close after you finish
27+
await instance.close()
28+
29+
asyncio.run(main())
30+

examples/sync.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import os
2+
import sys
3+
4+
root = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
5+
sys.path.append(root + '/')
6+
7+
from gate import GateSync
8+
9+
10+
def main():
11+
instance = GateSync({})
12+
instance.load_markets()
13+
symbol = "BTC/USDC"
14+
15+
# fetch ticker
16+
ticker = instance.fetch_ticker(symbol)
17+
print(ticker)
18+
19+
# create order
20+
order = instance.create_order("BTC/USDC", "limit", "buy", 1, 123456.789)
21+
print(order)
22+
23+
main()
24+

examples/websockets.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import os
2+
import sys
3+
import asyncio
4+
5+
# if CCXT is included locally
6+
# sys.path.append(os.path.dirname(os.path.dirname((os.path.abspath(__file__)))) + '/')
7+
8+
from gate import GateWs
9+
10+
if sys.platform == 'win32':
11+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
12+
13+
async def my_watch_ticker(exchange, symbol):
14+
while (True):
15+
result = await exchange.watch_ticker(symbol)
16+
print(result)
17+
18+
19+
async def my_watch_orderbook(exchange, symbol):
20+
while (True):
21+
result = await exchange.watch_order_book(symbol)
22+
print(result)
23+
24+
25+
26+
27+
async def main():
28+
instance = GateWs({})
29+
await instance.load_markets()
30+
symbol = "BTC/USDC"
31+
32+
# fetch ticker
33+
ticker = my_watch_ticker(instance, symbol)
34+
35+
# fetch orderbook
36+
ob = my_watch_orderbook(instance, symbol)
37+
38+
await asyncio.gather(ticker, ob)
39+
40+
# close after you finish
41+
await instance.close()
42+
43+
44+
45+
46+
asyncio.run(main())
47+

gate/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import sys
2+
import gate.ccxt as ccxt_module
3+
sys.modules['ccxt'] = ccxt_module
4+
5+
from gate.ccxt import gate as GateSync
6+
from gate.ccxt.async_support.gate import gate as GateAsync
7+
from gate.ccxt.pro.gate import gate as GateWs

gate/ccxt/__init__.py

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import sys
2+
import gate.ccxt as ccxt_module
3+
sys.modules['ccxt'] = ccxt_module
4+
5+
# -*- coding: utf-8 -*-
6+
7+
"""CCXT: CryptoCurrency eXchange Trading Library"""
8+
9+
# MIT License
10+
# Copyright (c) 2017 Igor Kroitor
11+
# Permission is hereby granted, free of charge, to any person obtaining a copy
12+
# of this software and associated documentation files (the "Software"), to deal
13+
# in the Software without restriction, including without limitation the rights
14+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15+
# copies of the Software, and to permit persons to whom the Software is
16+
# furnished to do so, subject to the following conditions:
17+
# The above copyright notice and this permission notice shall be included in all
18+
# copies or substantial portions of the Software.
19+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
# SOFTWARE.
26+
27+
# ----------------------------------------------------------------------------
28+
29+
__version__ = '4.4.87'
30+
31+
# ----------------------------------------------------------------------------
32+
33+
from ccxt.base.exchange import Exchange # noqa: F401
34+
from ccxt.base.precise import Precise # noqa: F401
35+
36+
from ccxt.base.decimal_to_precision import decimal_to_precision # noqa: F401
37+
from ccxt.base.decimal_to_precision import TRUNCATE # noqa: F401
38+
from ccxt.base.decimal_to_precision import ROUND # noqa: F401
39+
from ccxt.base.decimal_to_precision import ROUND_UP # noqa: F401
40+
from ccxt.base.decimal_to_precision import ROUND_DOWN # noqa: F401
41+
from ccxt.base.decimal_to_precision import DECIMAL_PLACES # noqa: F401
42+
from ccxt.base.decimal_to_precision import SIGNIFICANT_DIGITS # noqa: F401
43+
from ccxt.base.decimal_to_precision import TICK_SIZE # noqa: F401
44+
from ccxt.base.decimal_to_precision import NO_PADDING # noqa: F401
45+
from ccxt.base.decimal_to_precision import PAD_WITH_ZERO # noqa: F401
46+
47+
from ccxt.base import errors
48+
from ccxt.base.errors import BaseError # noqa: F401
49+
from ccxt.base.errors import ExchangeError # noqa: F401
50+
from ccxt.base.errors import AuthenticationError # noqa: F401
51+
from ccxt.base.errors import PermissionDenied # noqa: F401
52+
from ccxt.base.errors import AccountNotEnabled # noqa: F401
53+
from ccxt.base.errors import AccountSuspended # noqa: F401
54+
from ccxt.base.errors import ArgumentsRequired # noqa: F401
55+
from ccxt.base.errors import BadRequest # noqa: F401
56+
from ccxt.base.errors import BadSymbol # noqa: F401
57+
from ccxt.base.errors import OperationRejected # noqa: F401
58+
from ccxt.base.errors import NoChange # noqa: F401
59+
from ccxt.base.errors import MarginModeAlreadySet # noqa: F401
60+
from ccxt.base.errors import MarketClosed # noqa: F401
61+
from ccxt.base.errors import ManualInteractionNeeded # noqa: F401
62+
from ccxt.base.errors import InsufficientFunds # noqa: F401
63+
from ccxt.base.errors import InvalidAddress # noqa: F401
64+
from ccxt.base.errors import AddressPending # noqa: F401
65+
from ccxt.base.errors import InvalidOrder # noqa: F401
66+
from ccxt.base.errors import OrderNotFound # noqa: F401
67+
from ccxt.base.errors import OrderNotCached # noqa: F401
68+
from ccxt.base.errors import OrderImmediatelyFillable # noqa: F401
69+
from ccxt.base.errors import OrderNotFillable # noqa: F401
70+
from ccxt.base.errors import DuplicateOrderId # noqa: F401
71+
from ccxt.base.errors import ContractUnavailable # noqa: F401
72+
from ccxt.base.errors import NotSupported # noqa: F401
73+
from ccxt.base.errors import InvalidProxySettings # noqa: F401
74+
from ccxt.base.errors import ExchangeClosedByUser # noqa: F401
75+
from ccxt.base.errors import OperationFailed # noqa: F401
76+
from ccxt.base.errors import NetworkError # noqa: F401
77+
from ccxt.base.errors import DDoSProtection # noqa: F401
78+
from ccxt.base.errors import RateLimitExceeded # noqa: F401
79+
from ccxt.base.errors import ExchangeNotAvailable # noqa: F401
80+
from ccxt.base.errors import OnMaintenance # noqa: F401
81+
from ccxt.base.errors import InvalidNonce # noqa: F401
82+
from ccxt.base.errors import ChecksumError # noqa: F401
83+
from ccxt.base.errors import RequestTimeout # noqa: F401
84+
from ccxt.base.errors import BadResponse # noqa: F401
85+
from ccxt.base.errors import NullResponse # noqa: F401
86+
from ccxt.base.errors import CancelPending # noqa: F401
87+
from ccxt.base.errors import UnsubscribeError # noqa: F401
88+
from ccxt.base.errors import error_hierarchy # noqa: F401
89+
90+
from ccxt.gate import gate # noqa: F401
91+
92+
exchanges = [ 'gate',]
93+
94+
base = [
95+
'Exchange',
96+
'Precise',
97+
'exchanges',
98+
'decimal_to_precision',
99+
]
100+
101+
__all__ = base + errors.__all__ + exchanges

0 commit comments

Comments
 (0)