Skip to content

Commit 2d249d7

Browse files
author
github-actions
committed
[TRANSFER][PUBLISH]
1 parent abdde73 commit 2d249d7

File tree

5 files changed

+25
-275
lines changed

5 files changed

+25
-275
lines changed

.github/workflows/build-single-exchange.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
git config --local user.email "action@github.com"
3636
git config --local user.name "GitHub Action"
3737
git add README.md
38+
git add .
3839
git commit -m "pushback" || echo "No changes to commit"
3940
git push
4041

README.md

Lines changed: 0 additions & 260 deletions
This file was deleted.

build/templates/README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ def main():
3030
### Async
3131

3232
```Python
33+
import sys
3334
import asyncio
3435
from __exchangeName__ import __ExchangeName__Async
3536

37+
if sys.platform == 'win32':
38+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
39+
3640
async def main():
3741
instance = __ExchangeName__Async({})
3842
ob = await instance.fetch_order_book("__EXAMPLE_SYMBOL__")
@@ -41,6 +45,9 @@ async def main():
4145
# balance = await instance.fetch_balance()
4246
# order = await instance.create_order("__EXAMPLE_SYMBOL__", "limit", "buy", 1, 100000)
4347

48+
# once you are done with the exchange
49+
await instance.close()
50+
4451
asyncio.run(main())
4552
```
4653

@@ -49,14 +56,21 @@ asyncio.run(main())
4956
### Websockets
5057

5158
```Python
59+
import sys
5260
from __exchangeName__ import __ExchangeName__Ws
5361

62+
if sys.platform == 'win32':
63+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
64+
5465
async def main():
5566
instance = __ExchangeName__Ws({})
5667
while True:
5768
ob = await instance.watch_order_book("__EXAMPLE_SYMBOL__")
5869
print(ob)
5970
# orders = await instance.watch_orders("__EXAMPLE_SYMBOL__")
71+
72+
# once you are done with the exchange
73+
await instance.close()
6074
```
6175

6276

@@ -81,8 +95,6 @@ You can also construct custom requests to available "implicit" endpoints
8195
```
8296

8397

84-
85-
8698
## Available methods
8799

88100
### REST Unified

build/templates/examples/async.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
import sys
33
import asyncio
44

5-
root = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
6-
sys.path.append(root + '/')
5+
# if CCXT is included locally
6+
# sys.path.append(os.path.dirname(os.path.dirname((os.path.abspath(__file__)))) + '/')
77

88
from __exchangeName__ import __ExchangeName__Async
99

10-
# ********** on Windows, uncomment below **********
11-
# if sys.platform == 'win32':
12-
# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
10+
if sys.platform == 'win32':
11+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
1312

1413
async def main():
1514
instance = __ExchangeName__Async({})

build/templates/examples/websockets.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
import sys
33
import asyncio
44

5-
root = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
6-
sys.path.append(root + '/')
5+
# if CCXT is included locally
6+
# sys.path.append(os.path.dirname(os.path.dirname((os.path.abspath(__file__)))) + '/')
77

88
from __exchangeName__ import __ExchangeName__Ws
99

10-
# ********** on Windows, uncomment below **********
11-
# if sys.platform == 'win32':
12-
# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
10+
if sys.platform == 'win32':
11+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
1312

14-
15-
async def my_watch_ticker_my(exchange, symbol):
13+
async def my_watch_ticker(exchange, symbol):
1614
while (True):
1715
result = await exchange.watch_ticker(symbol)
1816
print(result)
@@ -32,7 +30,7 @@ async def main():
3230
symbol = "__EXAMPLE_SYMBOL__"
3331

3432
# fetch ticker
35-
ticker = my_watch_ticker_my(instance, symbol)
33+
ticker = my_watch_ticker(instance, symbol)
3634

3735
# fetch orderbook
3836
ob = my_watch_orderbook(instance, symbol)

0 commit comments

Comments
 (0)