Skip to content

Commit bdca4f8

Browse files
author
github-actions
committed
[TRANSFER][BUILD]
1 parent 4ad6866 commit bdca4f8

File tree

5 files changed

+19
-55
lines changed

5 files changed

+19
-55
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
# Get arguments
44
EXCHANGE_NAME=$1
5-
API_TOKEN=$2
6-
GITHUB_SHA=$3
5+
COMMIT_MSG=$2
76

87
# Clone and push to the repo
98
TEMP_DIR=$(mktemp -d)
109
TEMP_DIR_GIT="$TEMP_DIR/$EXCHANGE_NAME-python"
1110
echo "Cloning $EXCHANGE_NAME-python repository into $TEMP_DIR_GIT"
12-
git clone https://x-access-token:$API_TOKEN@github.com/ccxt/$EXCHANGE_NAME-python.git $TEMP_DIR_GIT
11+
git clone https://x-access-token:$GITHUB_API_TOKEN@github.com/ccxt/$EXCHANGE_NAME-python.git $TEMP_DIR_GIT
1312
# at first, clean th directory (except .git directory) and copy all files
1413
echo "Clone finished"
1514
rm -rf $TEMP_DIR_GIT/*
@@ -25,4 +24,4 @@ git config user.name github-actions
2524
git config user.email [email protected]
2625
git add .
2726
rm -f README.md
28-
(git commit -m "[BUILD]: $GITHUB_SHA" && git push origin main --force) || echo "No changes to commit"
27+
(git commit -m "$COMMIT_MSG" && git push origin main --force) || echo "No changes to commit"

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ jobs:
2020
- name: Install dependencies
2121
run: |
2222
cd build
23+
npm install
2324
npm install typescript
24-
npm install tsx
25+
2526
- name: Build
2627
run: |
2728
cd build
2829
# get repository name and it's first word before hyphen and pass that as argument
2930
REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2 | cut -d'-' -f1)
3031
npm run build -- $REPO_NAME
3132
32-
- name: Commit and push changes
33+
- name: Commit and push back changes
3334
run: |
3435
chmod +x .github/scripts/pushback.sh
3536
.github/scripts/pushback.sh
@@ -44,14 +45,14 @@ jobs:
4445
python -m pip install --upgrade pip
4546
pip install build twine
4647
47-
- name: Build
48+
- name: PyPi packager
4849
env:
4950
PYPI_API_SECRET_SP: ${{ secrets.PYPI_API_SECRET_SP }}
5051
run: |
5152
cd build
52-
npm run pypi-publish
53+
npm run pypi-packager
5354
54-
- name: Upload to PyPI
55+
- name: PyPi upload
5556
run: |
5657
cd ./temp_pypi
5758
python -m twine upload dist/*

README.md

Lines changed: 7 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,13 @@
1-
# gate-python
2-
Python SDK (sync and async) for Gate with Rest and WS capabilities.
1+
# about
32

4-
You can check Gate's docs here: [Docs](https://ccxt.com)
3+
this is dev.repo, not meant to be used by end users.
54

5+
# instructions
66

7-
You can check the SDK docs here: [SDK](https://docs.ccxt.com/#/exchanges/gate)
7+
- At first, generate `Personal Access Token` under `CCXT` org, with the access to this current repository and also to all other repositories (there are around 20 repositories named like: `github.com/ccxt/{exchange}-python`) with the scopes `actions, commit statuses, contents, workflows` and set that value for action secret with the name `API_TOKEN_FOR_CCXT_SINGLE_EXCHANGES`.
88

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*
9+
- Then inside `.github/workflows/transfer-all.yml` set the desired array of exchanges in matrix. On `push` event, if commit message contains `[build]`, this repo files will be distributed to those dozen exchange repositories.
1010

11-
## Installation
12-
13-
```
14-
pip install gate-io-api
15-
```
16-
17-
## Usage
18-
19-
### Async
20-
21-
```Python
22-
from gate_io_api import GateAsync
23-
24-
async def main():
25-
instance = GateAsync({})
26-
order = await instance.create_order(__EXAMPLE_SYMBOL__, "limit", "buy", 1, 100000)
27-
```
28-
29-
### Sync
30-
31-
```Python
32-
from gate_io_api import GateSync
33-
34-
def main():
35-
instance = GateSync({})
36-
order = instance.create_order(__EXAMPLE_SYMBOL__, "limit", "buy", 1, 100000)
37-
```
38-
39-
### Websockets
40-
41-
```Python
42-
from gate_io_api import GateWs
43-
44-
async def main():
45-
instance = GateWs({})
46-
while True:
47-
orders = await instance.watch_orders(__EXAMPLE_SYMBOL__)
48-
```
11+
- Immediately, as those repositories get `push` event, they will start build with `.github/workflows/build-single-exchange.yml` flow and each repo (you should set `PYPI_API_SECRET_SP` secret with pypi api key, under each repository) will push a package to pypi.org. Versions are incremental by patch version at this moment.
4912

13+
- All other things are WIP and can be customized.

build/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"build": "tsx build.ts",
9-
"pypi-publish": "tsx pypi-publish.ts"
9+
"pypi-packager": "tsx pypi-packager.ts"
1010
},
1111
"author": "",
1212
"license": "ISC",
1313
"dependencies": {
14-
"fs": "^0.0.1-security",
15-
"path": "^0.12.7",
14+
"fs": "*",
15+
"path": "*",
1616
"semver": "^7.7.1"
1717
},
1818
"devDependencies": {

0 commit comments

Comments
 (0)