Skip to content

Commit 7d5840e

Browse files
authored
Merge pull request #21 from tiagosiebler/readmeUpdate
chore(): update readme
2 parents 1ee8469 + cf3c2dc commit 7d5840e

File tree

4 files changed

+154
-17
lines changed

4 files changed

+154
-17
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Update README.md templates
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write # Grant write permissions to the contents
8+
9+
env:
10+
FILE_NAME: README.md
11+
12+
jobs:
13+
update-readme:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version-file: '.nvmrc'
23+
registry-url: https://registry.npmjs.org/
24+
cache: 'npm'
25+
26+
- name: Install
27+
run: npm ci --ignore-scripts
28+
29+
- name: Get the current date and time
30+
id: datetime
31+
run: echo "BRANCH_NAME=$(date +'actions_templates_%Y_%m_%d_%H%M%S')" >> $GITHUB_ENV
32+
33+
- name: Create update-template.sh script
34+
run: |
35+
cat << 'EOF' > update-template.sh
36+
#!/bin/bash
37+
38+
TEMPLATE_VALUE=$(curl -s $TEMPLATE_URL)
39+
40+
perl -0777 -i -pe "
41+
my \$tag = quotemeta('<!-- template_${TEMPLATE_TAG} -->');
42+
my \$end_tag = quotemeta('<!-- template_${TEMPLATE_TAG}_end -->');
43+
my \$replacement = '${TEMPLATE_VALUE}';
44+
45+
# Match the tag, then any amount of whitespace (including newlines), then the replacement, then any amount of whitespace, then the end tag.
46+
s/(\$tag)(\s*)(.*?)(\s*)(\$end_tag)/\$1\n\$replacement\n\$5/s;
47+
" "$FILE_NAME"
48+
49+
EOF
50+
chmod +x update-template.sh
51+
cat update-template.sh
52+
53+
- name: Fetch and update RELATED PROJECTS template
54+
run: ./update-template.sh
55+
env:
56+
TEMPLATE_URL: https://raw.githubusercontent.com/wiki/tiagosiebler/awesome-crypto-examples/Related-projects.md
57+
TEMPLATE_TAG: related_projects
58+
59+
- name: Fetch and update CONTRIBUTIONS template
60+
run: ./update-template.sh
61+
env:
62+
TEMPLATE_URL: https://raw.githubusercontent.com/wiki/tiagosiebler/awesome-crypto-examples/Contributions-%26-Thanks.md
63+
TEMPLATE_TAG: contributions
64+
65+
- name: Fetch and update STAR HISTORY template
66+
run: ./update-template.sh
67+
env:
68+
TEMPLATE_URL: https://raw.githubusercontent.com/wiki/tiagosiebler/awesome-crypto-examples/Star-History.md
69+
TEMPLATE_TAG: star_history
70+
71+
- name: Check for changes before running linter
72+
run: git diff
73+
74+
- name: Check for changes | PR URL HERE
75+
id: commitIfChanged
76+
run: |
77+
npx prettier -w README.md
78+
if git diff --quiet; then
79+
echo "No changes to commit"
80+
exit 0
81+
fi
82+
git config --global user.name 'github-actions[bot]'
83+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
84+
git checkout -b ${{ env.BRANCH_NAME }}
85+
git add $FILE_NAME
86+
git commit -m 'chore(): ${{ env.FILE_NAME }} template sections'
87+
git push origin ${{ env.BRANCH_NAME }}
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
1-
# awesome-crypto-examples
1+
# Awesome crypto examples
2+
3+
[![Build & Test](https://github.com/tiagosiebler/awesome-crypto-examples/actions/workflows/build.yml/badge.svg)](https://github.com/tiagosiebler/awesome-crypto-examples/actions/workflows/test.yml)
4+
[![last commit](https://img.shields.io/github/last-commit/tiagosiebler/awesome-crypto-examples)](https://github.com/tiagosiebler/awesome-crypto-examples)
5+
[![Telegram](https://img.shields.io/badge/chat-on%20telegram-blue.svg)](https://t.me/nodetraders)
26

37
Wondering how to "[insert something crypto & nodejs related]"? Welcome to a loose collection of node.js examples and demos in the world of algo trading (especially cryptocurrencies).
48

59
What kind of examples?
10+
611
- Working with crypto exchange REST APIs
712
- Working with crypto exchange WebSocket streams
813
- Anything else crypto + node.js?
914

1015
Note: these are not meant to suggest best practices. These are purely demonstrations for one (or more) way(s) for doing various things.
1116

12-
## Related projects
13-
Check out my related projects:
14-
- Try my connectors:
15-
- [binance](https://www.npmjs.com/package/binance)
16-
- [bybit-api](https://www.npmjs.com/package/bybit-api)
17-
- [okx-api](https://www.npmjs.com/package/okx-api)
18-
- [bitget-api](https://www.npmjs.com/package/bitget-api)
19-
- [ftx-api](https://www.npmjs.com/package/ftx-api)
20-
- Try my misc utilities:
21-
- [orderbooks](https://www.npmjs.com/package/orderbooks)
22-
- Check out my examples:
23-
- [awesome-crypto-examples](https://github.com/tiagosiebler/awesome-crypto-examples)
24-
2517
## Getting started
18+
2619
All examples are in node.js and/or typescript.
20+
2721
- Ensure you have node.js installed (see `.nvmrc` for the recommended version (or above))
2822
- Install dependencies: `npm install`
2923

3024
### Frequenty Asked Questions
25+
3126
Check out the wiki. Contributions welcome:
3227
https://github.com/tiagosiebler/awesome-crypto-examples/wiki
3328

3429
### Running examples (node.js)
3530

3631
Node.js examples will be any file that ends with `.js`. If the example has a readme, refer to the readme for specific instructions, otherwise use the following command to run the example with node.js:
32+
3733
```bash
3834
node src/path/to/example.js
3935
```
4036

4137
### Running examples (typescript)
4238

4339
Typescript examples will be any file that ends with `.ts`. If the example has a readme, refer to the readme for specific instructions, otherwise use the following command to run the example with typescript's ts-node:
40+
4441
```bash
4542
npx ts-node src/path/to/example.ts
4643
```
4744

4845
Refer to the following documentation for guidance on ts-node: https://www.npmjs.com/package/ts-node#overview
4946

5047
### Providing API keys
48+
5149
Some examples make private API calls (e.g. the [account monitoring](https://github.com/tiagosiebler/awesome-crypto-examples/blob/master/src/exchanges/binance/account-events/log-account-events.ts#L9-L10) ones). These rely on API credentials to make signed API calls to your account.
5250

5351
Either locally download a copy of this repo and edit the values directly, or provide these as environmental variables. If a sample has the following process.env snippet:
52+
5453
```
5554
const key = process.env.APIKEY || 'APIKEY';
5655
const secret = process.env.APISECRET || 'APISECRET';
5756
```
5857

5958
You can provide your API credentials (in unix & macOS environments) when executing the sample:
59+
6060
```bash
6161
APIKEY="yourkeyhere" APISECRET="yoursecrethere" npx ts-node src/exchanges/binance/account-events/log-account-events.ts
6262
```
@@ -71,3 +71,51 @@ PRs for various concepts welcome. Typescript preferred, but plain javascript is
7171
- If it's useful & reasonable for others to learn from, as big as you want!
7272
- Stuck on a problem and looking for a related sample?
7373
- Use the issues tab or join the [node.js algo traders telegram community](https://t.me/nodetraders)!
74+
75+
<!-- template_contributions -->
76+
77+
## Contributions & Thanks
78+
79+
Have my projects helped you? Share the love, there are many ways you can show your thanks:
80+
81+
- Star & share my projects.
82+
- Are my projects useful? Sponsor me on Github and support my effort to maintain & improve them: https://github.com/sponsors/tiagosiebler
83+
- Have an interesting project? Get in touch & invite me to it.
84+
- Or buy me all the coffee:
85+
- ETH(ERC20): `0xA3Bda8BecaB4DCdA539Dc16F9C54a592553Be06C` <!-- metamask -->
86+
87+
<!-- template_contributions_end -->
88+
89+
### Contributions & Pull Requests
90+
91+
Contributions are encouraged, I will review any incoming pull requests. See the issues tab for todo items.
92+
93+
<!-- template_related_projects -->
94+
95+
## Related projects
96+
97+
Check out my related JavaScript/TypeScript/Node.js projects:
98+
99+
- Try my REST API & WebSocket SDKs:
100+
- [Bybit-api Node.js SDK](https://www.npmjs.com/package/bybit-api)
101+
- [Okx-api Node.js SDK](https://www.npmjs.com/package/okx-api)
102+
- [Binance Node.js SDK](https://www.npmjs.com/package/binance)
103+
- [Gateio-api Node.js SDK](https://www.npmjs.com/package/gateio-api)
104+
- [Bitget-api Node.js SDK](https://www.npmjs.com/package/bitget-api)
105+
- [Kucoin-api Node.js SDK](https://www.npmjs.com/package/kucoin-api)
106+
- [Coinbase-api Node.js SDK](https://www.npmjs.com/package/coinbase-api)
107+
- [Bitmart-api Node.js SDK](https://www.npmjs.com/package/bitmart-api)
108+
- Try my misc utilities:
109+
- [OrderBooks Node.js](https://www.npmjs.com/package/orderbooks)
110+
- [Crypto Exchange Account State Cache](https://www.npmjs.com/package/accountstate)
111+
- Check out my examples:
112+
- [awesome-crypto-examples Node.js](https://github.com/tiagosiebler/awesome-crypto-examples)
113+
<!-- template_related_projects_end -->
114+
115+
<!-- template_star_history -->
116+
117+
## Star History
118+
119+
[![Star History Chart](https://api.star-history.com/svg?repos=tiagosiebler/bybit-api,tiagosiebler/okx-api,tiagosiebler/binance,tiagosiebler/bitget-api,tiagosiebler/bitmart-api,tiagosiebler/gateio-api,tiagosiebler/kucoin-api,tiagosiebler/coinbase-api,tiagosiebler/orderbooks,tiagosiebler/accountstate,tiagosiebler/awesome-crypto-examples&type=Date)](https://star-history.com/#tiagosiebler/bybit-api&tiagosiebler/okx-api&tiagosiebler/binance&tiagosiebler/bitget-api&tiagosiebler/bitmart-api&tiagosiebler/gateio-api&tiagosiebler/kucoin-api&tiagosiebler/coinbase-api&tiagosiebler/orderbooks&tiagosiebler/accountstate&tiagosiebler/awesome-crypto-examples&Date)
120+
121+
<!-- template_star_history_end -->

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "awesome-crypto-examples",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"private": true,
55
"description": "Awesome crypto automation & algo trading examples",
66
"main": "index.js",

0 commit comments

Comments
 (0)