Skip to content

Commit 24da2ab

Browse files
author
github-actions
committed
[BUILD]: 3407ac4e28045521b9ba7e842cb82066357bc8f9
1 parent d1d0561 commit 24da2ab

File tree

10 files changed

+267
-42
lines changed

10 files changed

+267
-42
lines changed

.github/scripts/push-to-repo.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Get arguments
4+
EXCHANGE_NAME=$1
5+
API_TOKEN=$2
6+
GITHUB_SHA=$3
7+
8+
# Clone and push to the repo
9+
TEMP_DIR=$(mktemp -d)
10+
TEMP_DIR_GIT="$TEMP_DIR/python-$EXCHANGE_NAME"
11+
git clone https://x-access-token:$API_TOKEN@github.com/ccxt/python-$EXCHANGE_NAME.git $TEMP_DIR_GIT
12+
rsync -av --exclude='.git' ./ $TEMP_DIR_GIT
13+
# remove all yml files except remote
14+
dir $TEMP_DIR_GIT/.github/workflows/
15+
rm -f $TEMP_DIR_GIT/.github/workflows/transfer-all.yml && rm -f $TEMP_DIR_GIT/.github/workflows/transfer-exchange.yml
16+
cd $TEMP_DIR_GIT
17+
git config user.name github-actions
18+
git config user.email [email protected]
19+
git add .
20+
(git commit -m "[BUILD]: $GITHUB_SHA" && git push origin main --force) || echo "No changes to commit"

.github/workflows/remote-build.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,15 @@ on:
44
branches:
55
- main
66

7-
env:
8-
EXCHANGES_JSON: '["binance", "okx", "kraken", "coinbase", "bybit"]'
9-
107
jobs:
118
build_for_pypi:
129
if: ${{ github.event.repository.name != 'ccxt-python-single-exchange' && contains(github.event.head_commit.message, '[BUILD]') }}
1310
runs-on: ubuntu-latest
1411
steps:
15-
# - name: Check repository name
16-
# id: check
17-
# run: |
18-
# if [ "${{ github.event.repository.name }}" == "ccxt-python-single-exchange" ]; then
19-
# echo "Repository is xyz, cancelling workflow"
20-
# exit 0
21-
# fi
2212
- name: Checkout code
2313
uses: actions/checkout@v4
2414
with:
2515
ref: ${{ github.ref }}
2616
persist-credentials: false
2717
- name: echo something
2818
run: echo "something"
29-
30-
readme_update:
31-
if: ${{ github.event.repository.name != 'ccxt-python-single-exchange' && contains(github.event.head_commit.message, '[BUILD]') }}
32-
runs-on: ubuntu-latest
33-
steps:
34-
- name: Checkout code
35-
uses: actions/checkout@v4
36-
with:
37-
ref: ${{ github.ref }}
38-
39-
- name: Update README with repository links
40-
run: chmod +x ./build/update-readme.sh && ./build/update-readme.sh
41-
42-
- name: Commit and push changes
43-
run: |
44-
git config --local user.email "[email protected]"
45-
git config --local user.name "GitHub Action"
46-
git add README.md
47-
git commit -m "Update README with exchange repository links" || echo "No changes to commit"
48-
git push

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,3 @@ cython_debug/
174174

175175
build/ccxt
176176
/meta.json
177-
/name

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
11
# central repo for single exchanges
22

3-
this is dev.repo, not meant to be used by end users.
4-
### See our other exchanges
5-
- [**binance** python](https://github.com/my/binance)
6-
- [**okx** python](https://github.com/my/okx)
7-
- [**kraken** python](https://github.com/my/kraken)
8-
- [**coinbase** python](https://github.com/my/coinbase)
9-
- [**bybit** python](https://github.com/my/bybit)
10-
3+
this is dev.repo, not meant to be used by end users.

build/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class build {
202202

203203
generateExamples () {
204204
const destinationDir = __dirname + `/../examples/`;
205-
cp (__dirname + '/sources/examples/', destinationDir);
205+
cp (__dirname + '/templates/examples/', destinationDir);
206206
// iterate through files and make replacements
207207
const files = fs.readdirSync(destinationDir);
208208
for (const file of files) {
@@ -215,7 +215,7 @@ class build {
215215

216216
generateReadme () {
217217
const destinationDir = __dirname + `/../README.md`;
218-
cp (__dirname + '/sources/README.md', destinationDir);
218+
cp (__dirname + '/templates/README.md', destinationDir);
219219
let fileContent = fs.readFileSync(destinationDir, 'utf8');
220220
fileContent = this.replaceGlobalRegexes(fileContent, []);
221221
fs.writeFileSync(destinationDir, fileContent);

build/global-configs.json

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,93 @@
11
{
22
"exchanges" : {
3+
"bingx": {
4+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
5+
"__PYTHON_PACKAGE_NAME__": "bingx",
6+
"__TEST_SYMBOL__": "BTC/USDT"
7+
},
8+
"bitget": {
9+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
10+
"__PYTHON_PACKAGE_NAME__": "bitget",
11+
"__TEST_SYMBOL__": "BTC/USDT"
12+
},
13+
"binance": {
14+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
15+
"__PYTHON_PACKAGE_NAME__": "binance",
16+
"__TEST_SYMBOL__": "BTC/USDT"
17+
},
18+
"bitmart": {
19+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
20+
"__PYTHON_PACKAGE_NAME__": "bitmart",
21+
"__TEST_SYMBOL__": "BTC/USDT"
22+
},
23+
"bitmex": {
24+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
25+
"__PYTHON_PACKAGE_NAME__": "bitmex-api",
26+
"__TEST_SYMBOL__": "BTC/USDT"
27+
},
328
"bybit": {
429
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://bybit.com/apidocs1",
5-
"__PYTHON_PACKAGE_NAME__": "bybit-exchange",
30+
"__PYTHON_PACKAGE_NAME__": "bybit-api",
31+
"__TEST_SYMBOL__": "BTC/USDT"
32+
},
33+
"coinex": {
34+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
35+
"__PYTHON_PACKAGE_NAME__": "coinex-api",
36+
"__TEST_SYMBOL__": "BTC/USDT"
37+
},
38+
"cryptocom": {
39+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
40+
"__PYTHON_PACKAGE_NAME__": "crypto-com-sdk",
41+
"__TEST_SYMBOL__": "BTC/USDT"
42+
},
43+
"gate": {
44+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
45+
"__PYTHON_PACKAGE_NAME__": "gate-io-api",
46+
"__TEST_SYMBOL__": "BTC/USDT"
47+
},
48+
"hashkey": {
49+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
50+
"__PYTHON_PACKAGE_NAME__": "hashkey",
51+
"__TEST_SYMBOL__": "BTC/USDT"
52+
},
53+
"htx": {
54+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
55+
"__PYTHON_PACKAGE_NAME__": "htx",
56+
"__TEST_SYMBOL__": "BTC/USDT"
57+
},
58+
"hyperliquid": {
59+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
60+
"__PYTHON_PACKAGE_NAME__": "hyperliquid",
61+
"__TEST_SYMBOL__": "BTC/USDT"
62+
},
63+
"kucoin": {
64+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
65+
"__PYTHON_PACKAGE_NAME__": "kucoin-api",
66+
"__TEST_SYMBOL__": "BTC/USDT"
67+
},
68+
"kucoinfutures": {
69+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
70+
"__PYTHON_PACKAGE_NAME__": "kucoin-futures-api",
71+
"__TEST_SYMBOL__": "BTC/USDT"
72+
},
73+
"mexc": {
74+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
75+
"__PYTHON_PACKAGE_NAME__": "mexc-exchange-api",
76+
"__TEST_SYMBOL__": "BTC/USDT"
77+
},
78+
"okx": {
79+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
80+
"__PYTHON_PACKAGE_NAME__": "okx-exchange",
81+
"__TEST_SYMBOL__": "BTC/USDT"
82+
},
83+
"woo": {
84+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
85+
"__PYTHON_PACKAGE_NAME__": "woo-api",
86+
"__TEST_SYMBOL__": "BTC/USDT"
87+
},
88+
"woofipro": {
89+
"__LINK_TO_OFFICIAL_EXCHANGE_DOCS__": "https://example.com",
90+
"__PYTHON_PACKAGE_NAME__": "woofipro-api",
691
"__TEST_SYMBOL__": "BTC/USDT"
792
}
893
},

build/templates/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# __exchangeName__-python
2+
Python SDK (sync and async) for __ExchangeName__ with Rest and WS capabilities.
3+
4+
You can check __ExchangeName__'s docs here: [Docs](__LINK_TO_OFFICIAL_EXCHANGE_DOCS__)
5+
6+
7+
You can check the SDK docs here: [SDK](https://docs.ccxt.com/#/exchanges/__exchangeName__)
8+
9+
*This package derives from CCXT and allows you to call pretty much every endpoint by either using the unified CCXT API or calling the endpoints directly*
10+
11+
## Installation
12+
13+
```
14+
pip install __PYTHON_PACKAGE_NAME__
15+
```
16+
17+
## Usage
18+
19+
### Async
20+
21+
```Python
22+
from __PYTHON_PACKAGE_NAME__ import __ExchangeName__Async
23+
24+
async def main():
25+
instance = __ExchangeName__Async({})
26+
order = await instance.create_order(__EXAMPLE_SYMBOL__, "limit", "buy", 1, 100000)
27+
```
28+
29+
### Sync
30+
31+
```Python
32+
from __PYTHON_PACKAGE_NAME__ import __ExchangeName__Sync
33+
34+
def main():
35+
instance = __ExchangeName__Sync({})
36+
order = instance.create_order(__EXAMPLE_SYMBOL__, "limit", "buy", 1, 100000)
37+
```
38+
39+
### Websockets
40+
41+
```Python
42+
from __PYTHON_PACKAGE_NAME__ import __ExchangeName__Ws
43+
44+
async def main():
45+
instance = __ExchangeName__Ws({})
46+
while True:
47+
orders = await instance.watch_orders(__EXAMPLE_SYMBOL__)
48+
```
49+

build/templates/examples/async.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import os
2+
import sys
3+
import asyncio
4+
5+
root = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
6+
sys.path.append(root + '/')
7+
8+
from __exchangeName__ import __ExchangeName__Async
9+
10+
# ********** on Windows, uncomment below **********
11+
# if sys.platform == 'win32':
12+
# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
13+
14+
async def main():
15+
instance = __ExchangeName__Async({})
16+
await instance.load_markets()
17+
symbol = "__TEST_SYMBOL__"
18+
19+
# fetch ticker
20+
#
21+
ticker = await instance.fetch_ticker(symbol)
22+
print(ticker)
23+
24+
# fetch ohlcv
25+
#
26+
ohlcv = await instance.fetch_ohlcv(symbol, "1m")
27+
print(ohlcv)
28+
29+
# close after you finish
30+
await instance.close()
31+
32+
asyncio.run(main())
33+

build/templates/examples/sync.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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 __exchangeName__ import __ExchangeName__Sync
8+
9+
10+
def main():
11+
instance = __ExchangeName__Sync({})
12+
instance.load_markets()
13+
symbol = "__TEST_SYMBOL__"
14+
15+
# fetch ticker
16+
#
17+
ticker = instance.fetch_ticker(symbol)
18+
print(ticker)
19+
20+
# fetch ohlcv
21+
#
22+
ohlcv = instance.fetch_ohlcv(symbol, "1m")
23+
print(ohlcv)
24+
25+
26+
main()
27+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import os
2+
import sys
3+
import asyncio
4+
5+
root = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
6+
sys.path.append(root + '/')
7+
8+
from __exchangeName__ import __ExchangeName__Ws
9+
10+
# ********** on Windows, uncomment below **********
11+
# if sys.platform == 'win32':
12+
# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
13+
14+
15+
async def my_watch_ticker_my(exchange, symbol):
16+
while (True):
17+
result = await exchange.watch_ticker(symbol)
18+
print(result)
19+
20+
21+
async def my_watch_orderbook(exchange, symbol):
22+
while (True):
23+
result = await exchange.watch_order_book(symbol)
24+
print(result)
25+
26+
27+
28+
29+
async def main():
30+
instance = __ExchangeName__Ws({})
31+
await instance.load_markets()
32+
symbol = "__TEST_SYMBOL__"
33+
34+
# fetch ticker
35+
ticker = my_watch_ticker_my(instance, symbol)
36+
37+
# fetch orderbook
38+
ob = my_watch_orderbook(instance, symbol)
39+
40+
await asyncio.gather(ticker, ob)
41+
42+
# close after you finish
43+
await instance.close()
44+
45+
46+
47+
48+
asyncio.run(main())
49+

0 commit comments

Comments
 (0)