Upload 5 files
Browse files- README.md +12 -0
- app.py +91 -0
- gitattributes.txt +34 -0
- links.txt +5 -0
- requirements.txt +53 -0
README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Bindash
|
| 3 |
+
emoji: 🚀
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: yellow
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.15.2
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import json
|
| 3 |
+
import streamlit as st
|
| 4 |
+
import pandas as pd
|
| 5 |
+
import datetime
|
| 6 |
+
from st_aggrid import AgGrid, GridOptionsBuilder, JsCode
|
| 7 |
+
|
| 8 |
+
url_pos = "https://www.binance.com/bapi/futures/v1/public/future/leaderboard/getOtherPosition"
|
| 9 |
+
url = "https://www.binance.com/fr/futures-activity/leaderboard/user?encryptedUid=EE56F412D7DAB7DBAFCEC2147FA2D223"
|
| 10 |
+
url_perf = "https://www.binance.com/bapi/futures/v2/public/future/leaderboard/getOtherPerformance"
|
| 11 |
+
url_name = "https://www.binance.com/bapi/futures/v2/public/future/leaderboard/getOtherLeaderboardBaseInfo"
|
| 12 |
+
headers = {
|
| 13 |
+
'Content-Type': 'application/json',
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
def get_data(id: str):
|
| 17 |
+
payload = json.dumps({
|
| 18 |
+
"encryptedUid": id,
|
| 19 |
+
"tradeType": "PERPETUAL"
|
| 20 |
+
})
|
| 21 |
+
|
| 22 |
+
response = requests.request("POST", url_pos, headers=headers, data=payload)
|
| 23 |
+
|
| 24 |
+
x = response.json()["data"]["otherPositionRetList"]
|
| 25 |
+
itog = []
|
| 26 |
+
for i in x:
|
| 27 |
+
if 'updateTime' in i.keys():
|
| 28 |
+
# breakpoint()
|
| 29 |
+
i.pop('updateTime')
|
| 30 |
+
i.pop('yellow')
|
| 31 |
+
i.pop('tradeBefore')
|
| 32 |
+
i["updateTimeStamp"] = datetime.datetime.fromtimestamp(i["updateTimeStamp"]//1000)
|
| 33 |
+
i["roe"] = i["roe"]*100
|
| 34 |
+
i["roe"] = round(i["roe"], 2)
|
| 35 |
+
i["entryPrice"] = round(i["entryPrice"], 3)
|
| 36 |
+
i["markPrice"] = round(i["markPrice"], 3)
|
| 37 |
+
i["pnl"] = round(i["pnl"], 2)
|
| 38 |
+
|
| 39 |
+
itog.append(pd.DataFrame.from_dict([i]))
|
| 40 |
+
itog = pd.concat(itog , axis=0, ignore_index=True)[["symbol", "amount", "leverage","entryPrice","markPrice", "pnl", "roe","updateTimeStamp"]]
|
| 41 |
+
return itog
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def get_name(id: str):
|
| 45 |
+
payload = json.dumps({
|
| 46 |
+
"encryptedUid": id
|
| 47 |
+
})
|
| 48 |
+
|
| 49 |
+
response = requests.request("POST", url_name, headers=headers, data=payload)
|
| 50 |
+
x = response.json()["data"]["nickName"]
|
| 51 |
+
return x
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def get_table(id, name):
|
| 55 |
+
df = get_data(id)
|
| 56 |
+
gd= GridOptionsBuilder.from_dataframe(df)
|
| 57 |
+
cellstyle_jscode = JsCode("""
|
| 58 |
+
function(params){
|
| 59 |
+
if (params.value < '0') {
|
| 60 |
+
return{
|
| 61 |
+
'color': 'red'
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
if (params.value > '0') {
|
| 65 |
+
return{
|
| 66 |
+
'color': 'green'
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
""")
|
| 71 |
+
gd.configure_default_column(min_column_width=1)
|
| 72 |
+
gd.configure_columns(column_names= ["pnl", "roe", "amount"], cellStyle= cellstyle_jscode)
|
| 73 |
+
grid_options = gd.build()
|
| 74 |
+
st.header(name)
|
| 75 |
+
return AgGrid(df, gridOptions=grid_options, allow_unsafe_jscode=True, fit_columns_on_grid_load=True)
|
| 76 |
+
|
| 77 |
+
with open("./links.txt", 'r') as f:
|
| 78 |
+
links = f.readlines()
|
| 79 |
+
links = [i.strip().replace("https://www.binance.com/fr/futures-activity/leaderboard/user?encryptedUid=", "") for i in links]
|
| 80 |
+
links = {get_name(i):i for i in links}
|
| 81 |
+
|
| 82 |
+
print(links)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
st.set_page_config(layout="wide")
|
| 86 |
+
|
| 87 |
+
op = st.multiselect("traders", options=links.keys())
|
| 88 |
+
print(op)
|
| 89 |
+
for i, name in enumerate(op):
|
| 90 |
+
get_table(links[name], name)
|
| 91 |
+
|
gitattributes.txt
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
links.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
https://www.binance.com/fr/futures-activity/leaderboard/user?encryptedUid=EE56F412D7DAB7DBAFCEC2147FA2D223
|
| 2 |
+
https://www.binance.com/fr/futures-activity/leaderboard/user?encryptedUid=391C2981F65164BECCB630D3462C5813
|
| 3 |
+
https://www.binance.com/fr/futures-activity/leaderboard/user?encryptedUid=94200454B9D1D193EE24E080FF8B36DB
|
| 4 |
+
https://www.binance.com/fr/futures-activity/leaderboard/user?encryptedUid=70A2F92CE1059C2EC1D7617339CA1EDE
|
| 5 |
+
https://www.binance.com/fr/futures-activity/leaderboard/user?encryptedUid=5AB29AD22EBD8DCC05A4E75D22974B79
|
requirements.txt
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
altair==4.2.0
|
| 2 |
+
attrs==22.2.0
|
| 3 |
+
blinker==1.5
|
| 4 |
+
cachetools==5.2.0
|
| 5 |
+
certifi==2022.12.7
|
| 6 |
+
charset-normalizer==2.1.1
|
| 7 |
+
click==8.1.3
|
| 8 |
+
colorama==0.4.6
|
| 9 |
+
commonmark==0.9.1
|
| 10 |
+
decorator==5.1.1
|
| 11 |
+
entrypoints==0.4
|
| 12 |
+
gitdb==4.0.10
|
| 13 |
+
GitPython==3.1.30
|
| 14 |
+
greenlet==2.0.1
|
| 15 |
+
idna==3.4
|
| 16 |
+
importlib-metadata==6.0.0
|
| 17 |
+
Jinja2==3.1.2
|
| 18 |
+
jsonschema==4.17.3
|
| 19 |
+
MarkupSafe==2.1.1
|
| 20 |
+
numpy==1.24.1
|
| 21 |
+
packaging==22.0
|
| 22 |
+
pandas==1.5.2
|
| 23 |
+
Pillow==9.4.0
|
| 24 |
+
playwright==1.29.1
|
| 25 |
+
protobuf==3.20.3
|
| 26 |
+
pyarrow==10.0.1
|
| 27 |
+
pydeck==0.8.0
|
| 28 |
+
pyee==9.0.4
|
| 29 |
+
Pygments==2.14.0
|
| 30 |
+
Pympler==1.0.1
|
| 31 |
+
pyrsistent==0.19.3
|
| 32 |
+
python-dateutil==2.8.2
|
| 33 |
+
python-decouple==3.6
|
| 34 |
+
pytz==2022.7
|
| 35 |
+
pytz-deprecation-shim==0.1.0.post0
|
| 36 |
+
requests==2.28.1
|
| 37 |
+
rich==13.0.1
|
| 38 |
+
semver==2.13.0
|
| 39 |
+
six==1.16.0
|
| 40 |
+
smmap==5.0.0
|
| 41 |
+
SQLAlchemy==1.4.46
|
| 42 |
+
streamlit==1.16.0
|
| 43 |
+
streamlit-aggrid==0.3.3
|
| 44 |
+
toml==0.10.2
|
| 45 |
+
toolz==0.12.0
|
| 46 |
+
tornado==6.2
|
| 47 |
+
typing_extensions==4.4.0
|
| 48 |
+
tzdata==2022.7
|
| 49 |
+
tzlocal==4.2
|
| 50 |
+
urllib3==1.26.13
|
| 51 |
+
validators==0.20.0
|
| 52 |
+
watchdog==2.2.1
|
| 53 |
+
zipp==3.11.0
|