Skip to content

Commit ce4d58e

Browse files
authored
Merge pull request #37 from Reya-Labs/feat/spot
Support SPOT matching engine
2 parents 7738ada + c45eca0 commit ce4d58e

153 files changed

Lines changed: 21283 additions & 507 deletions

File tree

Some content is hidden

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

.env.example

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1-
# Required for consuming data
2-
REYA_WS_URL=
1+
### Cronos (testnet)
2+
CHAIN_ID=89346162
3+
REYA_WS_URL="wss://websocket-testnet.reya.xyz/"
4+
REYA_API_URL="https://api-cronos.reya.xyz/v2"
35

4-
# Required for running actions on Reya DEX
5-
PRIVATE_KEY=
6-
ACCOUNT_ID=
7-
CHAIN_ID= # 1729 mainnet and 89346162 cronos
6+
### Reya Network (mainnet)
7+
#CHAIN_ID=1729
8+
#REYA_WS_URL="wss://ws.reya.xyz/"
9+
#REYA_API_URL="https://api.reya.xyz/v2"
810

9-
# The wallet address that owns ACCOUNT_ID
10-
OWNER_WALLET_ADDRESS=
11+
### Staging (uses mainnet chain ID 1729)
12+
#CHAIN_ID=1729
13+
#REYA_WS_URL="wss://websocket-staging.reya.xyz"
14+
#REYA_API_URL="https://api-staging.reya.xyz/v2"
1115

12-
### Reya Cronos (testnet) example
13-
ACCOUNT_ID=replaceme
14-
PRIVATE_KEY=replacemereplacemereplacemereplacemereplacemereplacemereplaceme
15-
CHAIN_ID=89346162
16-
REYA_WS_URL="wss://websocket-testnet.reya.xyz/"
17-
OWMNER_WALLET_ADDRESS=replaceme
16+
# PERP_ACCOUNT_ID_1
17+
PERP_ACCOUNT_ID_1=
18+
PERP_PRIVATE_KEY_1=
19+
PERP_WALLET_ADDRESS_1=
20+
21+
# SPOT_ACCOUNT_ID_1
22+
SPOT_ACCOUNT_ID_1=
23+
SPOT_PRIVATE_KEY_1=
24+
SPOT_WALLET_ADDRESS_1=
1825

19-
### Reya Network (mainnet) example
20-
ACCOUNT_ID=replaceme
21-
PRIVATE_KEY=replacemereplacemereplacemereplacemereplacemereplacemereplaceme
22-
CHAIN_ID=1729
23-
REYA_WS_URL="wss://ws.reya.xyz/"
24-
OWNER_WALLET_ADDRESS=replaceme
26+
# SPOT_ACCOUNT_ID_2
27+
SPOT_ACCOUNT_ID_2=
28+
SPOT_PRIVATE_KEY_2=
29+
SPOT_WALLET_ADDRESS_2=

.github/workflows/create-release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
- pyproject.toml
99
- sdk/_version.py
1010

11+
env:
12+
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Reya Bot
13+
CI_COMMIT_EMAIL: devcold@voltz.xyz
14+
1115
jobs:
1216
create-release:
1317
runs-on: ubuntu-latest
@@ -76,8 +80,8 @@ jobs:
7680
COMMIT_SHA="${{ github.sha }}"
7781
7882
# Create annotated tag with v prefix
79-
git config --local user.email "action@github.com"
80-
git config --local user.name "GitHub Action"
83+
git config --local user.email "${{ env.CI_COMMIT_EMAIL }}"
84+
git config --local user.name "${{ env.CI_COMMIT_AUTHOR }}"
8185
git tag -a "v$VERSION" -m "Release version v$VERSION
8286
8387
Auto-tagged after merge to main branch.

.github/workflows/version-consistency.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
pull_request:
77
branches: [main, develop]
88

9+
env:
10+
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Reya Bot
11+
CI_COMMIT_EMAIL: devcold@voltz.xyz
12+
913
jobs:
1014
version-consistency:
1115
runs-on: ubuntu-latest
@@ -107,11 +111,29 @@ jobs:
107111
BASE_SHA=$(git merge-base HEAD origin/${{ github.base_ref }})
108112
109113
if git diff $BASE_SHA HEAD -- pyproject.toml | grep -q '^\+.*version = '; then
110-
echo "VERSION_MANUALLY_MODIFIED=true" >> $GITHUB_ENV
111-
echo "Version was manually modified in this PR"
114+
echo "Version change detected in pyproject.toml"
115+
116+
# Check if the version change was made by the CI bot (auto-commit)
117+
# Get the commit that last modified the version line in pyproject.toml
118+
LAST_VERSION_COMMIT=$(git log --oneline -1 --format="%H" -- pyproject.toml)
119+
LAST_VERSION_AUTHOR=$(git log --oneline -1 --format="%an" -- pyproject.toml)
120+
LAST_VERSION_MESSAGE=$(git log --oneline -1 --format="%s" -- pyproject.toml)
121+
122+
echo "Last version commit: $LAST_VERSION_COMMIT"
123+
echo "Last version author: $LAST_VERSION_AUTHOR"
124+
echo "Last version message: $LAST_VERSION_MESSAGE"
125+
126+
# Check if it was an auto-commit by the CI bot
127+
if [[ "$LAST_VERSION_MESSAGE" == "chore: bump SDK version to"* ]] && [[ "$LAST_VERSION_AUTHOR" == *"Reya Bot"* ]]; then
128+
echo "VERSION_MANUALLY_MODIFIED=false" >> $GITHUB_ENV
129+
echo "Version was modified by CI bot (auto-commit), not manually"
130+
else
131+
echo "VERSION_MANUALLY_MODIFIED=true" >> $GITHUB_ENV
132+
echo "Version was manually modified in this PR"
133+
fi
112134
else
113135
echo "VERSION_MANUALLY_MODIFIED=false" >> $GITHUB_ENV
114-
echo "Version was not manually modified in this PR"
136+
echo "Version was not modified in this PR"
115137
fi
116138
117139
- name: Extract version components
@@ -197,8 +219,8 @@ jobs:
197219
- name: Commit version bump
198220
if: github.event_name == 'pull_request' && env.NEW_VERSION != ''
199221
run: |
200-
git config --local user.email "action@github.com"
201-
git config --local user.name "GitHub Action"
222+
git config --local user.email "${{ env.CI_COMMIT_EMAIL }}"
223+
git config --local user.name "${{ env.CI_COMMIT_AUTHOR }}"
202224
git add pyproject.toml
203225
git commit -m "chore: bump SDK version to $NEW_VERSION"
204226
git push origin HEAD:${{ github.head_ref }}

.openapi-generator/FILES

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,24 @@ sdk/open_api/exceptions.py
1313
sdk/open_api/models/__init__.py
1414
sdk/open_api/models/account.py
1515
sdk/open_api/models/account_balance.py
16+
sdk/open_api/models/account_type.py
1617
sdk/open_api/models/asset_definition.py
1718
sdk/open_api/models/cancel_order_request.py
1819
sdk/open_api/models/cancel_order_response.py
1920
sdk/open_api/models/candle_history_data.py
2021
sdk/open_api/models/create_order_request.py
2122
sdk/open_api/models/create_order_response.py
23+
sdk/open_api/models/depth.py
24+
sdk/open_api/models/depth_type.py
2225
sdk/open_api/models/execution_type.py
2326
sdk/open_api/models/fee_tier_parameters.py
2427
sdk/open_api/models/global_fee_parameters.py
28+
sdk/open_api/models/level.py
2529
sdk/open_api/models/liquidity_parameters.py
2630
sdk/open_api/models/market_definition.py
2731
sdk/open_api/models/market_summary.py
32+
sdk/open_api/models/mass_cancel_request.py
33+
sdk/open_api/models/mass_cancel_response.py
2834
sdk/open_api/models/order.py
2935
sdk/open_api/models/order_status.py
3036
sdk/open_api/models/order_type.py
@@ -40,6 +46,7 @@ sdk/open_api/models/server_error_code.py
4046
sdk/open_api/models/side.py
4147
sdk/open_api/models/spot_execution.py
4248
sdk/open_api/models/spot_execution_list.py
49+
sdk/open_api/models/spot_market_definition.py
4350
sdk/open_api/models/tier_type.py
4451
sdk/open_api/models/time_in_force.py
4552
sdk/open_api/models/wallet_configuration.py
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""
2+
REST API examples for perpetual (perps) trading.
3+
4+
These examples demonstrate how to interact with the Reya Trading API
5+
for perpetual futures markets (e.g., ETHRUSDPERP, BTCRUSDPERP).
6+
"""
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
"""
33
Example script showing how to get accounts for a wallet address using the Reya Trading SDK.
44
5-
Before running this example, ensure you have a .env file with the following variables:
6-
- PRIVATE_KEY: Your Ethereum private key
5+
Requirements:
76
- CHAIN_ID: The chain ID (1729 for mainnet, 89346162 for testnet)
7+
- PERP_PRIVATE_KEY_1: Your Ethereum private key
8+
- PERP_WALLET_ADDRESS_1: Your wallet address
9+
10+
Usage:
11+
python -m examples.rest_api.perps.account_info
812
"""
913
import asyncio
1014

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
"""
33
Example script showing how to get assets information using the Reya Trading SDK.
44
5-
Before running this example, ensure you have a .env file with the following variables:
6-
- API_URL: (optional) The API URL to use
5+
Requirements:
6+
- CHAIN_ID: The chain ID (1729 for mainnet, 89346162 for testnet)
7+
- PERP_WALLET_ADDRESS_1: Your wallet address
8+
9+
Usage:
10+
python -m examples.rest_api.perps.assets_example
711
"""
812
import asyncio
913

examples/rest_api/markets_example.py renamed to examples/rest_api/perps/markets_example.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
"""
33
Example script showing how to get markets information using the Reya Trading SDK.
44
5-
Before running this example, ensure you have a .env file with the following variables:
6-
- API_URL: (optional) The API URL to use
5+
Requirements:
6+
- CHAIN_ID: The chain ID (1729 for mainnet, 89346162 for testnet)
7+
- PERP_WALLET_ADDRESS_1: Your wallet address
8+
9+
Usage:
10+
python -m examples.rest_api.perps.markets_example
711
"""
812

913
import asyncio
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
- Take Profit (TP) Orders
1010
- Order Cancellation
1111
12-
Before running this example, ensure you have a .env file with the following variables:
13-
- PRIVATE_KEY: Your Ethereum private key
14-
- ACCOUNT_ID: Your Reya account ID
12+
Requirements:
1513
- CHAIN_ID: The chain ID (1729 for mainnet, 89346162 for testnet)
16-
- API_URL: The API URL (optional, defaults based on chain ID)
14+
- PERP_ACCOUNT_ID_1: Your Reya account ID
15+
- PERP_PRIVATE_KEY_1: Your Ethereum private key
16+
- PERP_WALLET_ADDRESS_1: Your wallet address
17+
18+
Usage:
19+
python -m examples.rest_api.perps.order_entry
1720
"""
1821
import asyncio
1922
import logging
@@ -239,7 +242,7 @@ async def main():
239242
load_dotenv()
240243

241244
# Verify required environment variables
242-
required_vars = ["PRIVATE_KEY", "ACCOUNT_ID"]
245+
required_vars = ["PERP_PRIVATE_KEY_1", "PERP_ACCOUNT_ID_1", "PERP_WALLET_ADDRESS_1"]
243246
missing_vars = [var for var in required_vars if not os.getenv(var)]
244247

245248
if missing_vars:
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#!/usr/bin/env python3
2-
"""Example script showing how to get price information using the Reya Trading SDK.
2+
"""
3+
Example script showing how to get price information using the Reya Trading SDK.
4+
5+
Requirements:
6+
- CHAIN_ID: The chain ID (1729 for mainnet, 89346162 for testnet)
7+
- PERP_WALLET_ADDRESS_1: Your wallet address
38
4-
Before running this example, ensure you have a .env file with the following variables:
5-
- API_URL: (optional) The API URL to use
9+
Usage:
10+
python -m examples.rest_api.perps.prices_example
611
"""
712
import asyncio
813

0 commit comments

Comments
 (0)