python 3.11 flex SDK działa
This commit is contained in:
142
.gitignore
vendored
Normal file
142
.gitignore
vendored
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
# Environment variables
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
*.so
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
pip-wheel-metadata/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
Pipfile.lock
|
||||||
|
|
||||||
|
# PEP 582
|
||||||
|
__pypackages__/
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
celerybeat-schedule
|
||||||
|
celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# IDE files
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
|
||||||
|
# OS generated files
|
||||||
|
.DS_Store
|
||||||
|
.DS_Store?
|
||||||
|
._*
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
ehthumbs.db
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
|
logs/
|
||||||
|
|
||||||
|
# Node modules (if using any JS tools)
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Private keys and certificates
|
||||||
|
*.pem
|
||||||
|
*.key
|
||||||
|
*.crt
|
||||||
|
*.csr
|
||||||
|
*.p12
|
||||||
|
*.pfx
|
||||||
|
|
||||||
|
# Database files
|
||||||
|
*.db
|
||||||
|
*.sqlite
|
||||||
|
*.sqlite3
|
||||||
|
|
||||||
|
# Configuration files with sensitive data
|
||||||
|
config.json
|
||||||
|
secrets.json
|
||||||
84
02_market.py
Normal file
84
02_market.py
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import os
|
||||||
|
import asyncio
|
||||||
|
from flextrade.flextrade_client import Client
|
||||||
|
from flextrade.constants.markets import (
|
||||||
|
BASE_MARKET_ETH_USD, BASE_MARKET_BTC_USD, BASE_MARKET_BNB_USD,
|
||||||
|
BASE_MARKET_SHIB_USD, BASE_MARKET_PEPE_USD, BASE_MARKET_SUI_USD,
|
||||||
|
BASE_MARKET_DOGE_USD, BASE_MARKET_AAVE_USD, BASE_MARKET_HBAR_USD,
|
||||||
|
BASE_MARKET_VIRTUAL_USD, BASE_MARKET_ADA_USD, BASE_MARKET_PENDLE_USD,
|
||||||
|
BASE_MARKET_TRX_USD, BASE_MARKET_AVAX_USD, BASE_MARKET_UNI_USD,
|
||||||
|
BASE_MARKET_SOL_USD, BASE_MARKET_LINK_USD, BASE_MARKET_XRP_USD,
|
||||||
|
BASE_MARKET_TON_USD
|
||||||
|
)
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
RPC_URL = os.getenv("RPC_URL")
|
||||||
|
PRIVATE_KEY = os.getenv("PRIVATE_KEY")
|
||||||
|
|
||||||
|
# List of all markets to test
|
||||||
|
MARKETS = [
|
||||||
|
BASE_MARKET_ETH_USD,
|
||||||
|
BASE_MARKET_BTC_USD,
|
||||||
|
BASE_MARKET_BNB_USD,
|
||||||
|
BASE_MARKET_SHIB_USD,
|
||||||
|
BASE_MARKET_PEPE_USD,
|
||||||
|
BASE_MARKET_SUI_USD,
|
||||||
|
BASE_MARKET_DOGE_USD,
|
||||||
|
BASE_MARKET_AAVE_USD,
|
||||||
|
BASE_MARKET_HBAR_USD,
|
||||||
|
BASE_MARKET_VIRTUAL_USD,
|
||||||
|
BASE_MARKET_ADA_USD,
|
||||||
|
BASE_MARKET_PENDLE_USD,
|
||||||
|
BASE_MARKET_TRX_USD,
|
||||||
|
BASE_MARKET_AVAX_USD,
|
||||||
|
BASE_MARKET_UNI_USD,
|
||||||
|
BASE_MARKET_SOL_USD,
|
||||||
|
BASE_MARKET_LINK_USD,
|
||||||
|
BASE_MARKET_XRP_USD,
|
||||||
|
BASE_MARKET_TON_USD
|
||||||
|
]
|
||||||
|
|
||||||
|
def print_market_info(market_info):
|
||||||
|
"""Helper function to print market information"""
|
||||||
|
print('Market {0}'.format(market_info["market"]))
|
||||||
|
print('Price: {0:.4f}'.format(market_info["price"]))
|
||||||
|
print('Long: {0:.2f}'.format((market_info["long_size"])))
|
||||||
|
print('Short: {0:.2f}'.format((market_info["short_size"])))
|
||||||
|
print('Funding rate 1H: {0:.6f}%'.format(
|
||||||
|
(market_info["funding_rate"]["1H"])))
|
||||||
|
print('Funding rate 8H: {0:.6f}%'.format(
|
||||||
|
(market_info["funding_rate"]["8H"])))
|
||||||
|
print('Funding rate 24H: {0:.6f}%'.format(
|
||||||
|
(market_info["funding_rate"]["24H"])))
|
||||||
|
print('Funding rate 1Y: {0:.6f}%'.format(
|
||||||
|
(market_info["funding_rate"]["1Y"])))
|
||||||
|
print('Borrowing rate 1H: {0:.6f}%'.format(
|
||||||
|
(market_info["borrowing_rate"]["1H"])))
|
||||||
|
print('Borrowing rate 8H: {0:.6f}%'.format(
|
||||||
|
(market_info["borrowing_rate"]["8H"])))
|
||||||
|
print('Borrowing rate 24H: {0:.6f}%'.format(
|
||||||
|
(market_info["borrowing_rate"]["24H"])))
|
||||||
|
print('Borrowing rate 1Y: {0:.6f}%'.format(
|
||||||
|
(market_info["borrowing_rate"]["1Y"])))
|
||||||
|
print('-' * 50) # Separator line
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
client = Client(
|
||||||
|
eth_private_key=PRIVATE_KEY,
|
||||||
|
rpc_url=RPC_URL
|
||||||
|
)
|
||||||
|
|
||||||
|
print("Testing all markets...\n")
|
||||||
|
|
||||||
|
for market in MARKETS:
|
||||||
|
try:
|
||||||
|
market_info = client.public.get_market_info(market)
|
||||||
|
print_market_info(market_info)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error fetching market {market}: {e}")
|
||||||
|
print('-' * 50)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
asyncio.run(main())
|
||||||
1
fp-sdk-python
Submodule
1
fp-sdk-python
Submodule
Submodule fp-sdk-python added at afa1153601
BIN
python venv.PNG
Normal file
BIN
python venv.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Reference in New Issue
Block a user