cyberjunky / 3commas-cyber-bots

3Commas bot helpers, AltRank, GalaxyScore, Watchlists, Auto-Compound, TrailingStopLoss, TakeProfitIncrement
MIT License
209 stars 68 forks source link

galaxyscore no fetching correct LunarCrush coin ranking (not ordering in desc) #91

Closed chespix closed 2 years ago

chespix commented 2 years ago

Describe the bug Im running the same galaxyscore script in my personal computer and on a raspberry PI. On my computer it works as expected, and updates the bot with the top pairs, given the configuration. But on the raspberry PI, I see it fails on error "None of the LunarCrush pairs are present on the Paper Account XXXXX (paper_trading) exchange!"

Ive been checking the log files after turning DEBUG on, and Ive found that on the raspberry PI, when the script fetches the ranking from lunarCrush, is not adding the "&desc=True" to the HTTP request.

To Reproduce Steps to reproduce the behavior:

  1. Which program you run

galaxyscore.py

  1. Relevant settings used (don't paste your bot-id's, or any api-key values!)

[settings] timezone = America/Buenos_Aires timeinterval = 1800 debug = True logrotate = 7 botids = [XXXXXX] numberofpairs = 10 maxaltrankscore = 500 3c-apikey = XXXXXXX 3c-apisecret = XXXXXXX lc-apikey = XXXXXXX lc-fetchlimit = 150 notifications = True notify-urls = ["tgram://xxxxxx/"]

  1. Error you get

Im pasting the output of my personal computer first (working script) and from my raspberry PI after (not working) so you can see the different coins fetched from galaxyscore.

PERSONAL COMPUTER OUTPUT:

2022-02-10 11:01:50 - galaxyscore - DEBUG - https://api.lunarcrush.com:443 "GET /v2?data=market&type=fast&sort=gs&limit=150&key=xxxxxxxx&desc=True HTTP/1.1" 200 60023 2022-02-10 11:01:51 - galaxyscore - DEBUG - rank: 1 acr: 300 gs:81.0 s:ICP 'Internet Computer ' volume in btc: 5042.96 categories:[] 2022-02-10 11:01:51 - galaxyscore - DEBUG - rank: 2 acr: 311 gs:80.5 s:CTK 'CertiK ' volume in btc: 171.69 categories:[] 2022-02-10 11:01:51 - galaxyscore - DEBUG - rank: 3 acr: 214 gs:80.0 s:HBAR 'Hedera Hashgraph ' volume in btc: 1600.19 categories:[] 2022-02-10 11:01:51 - galaxyscore - DEBUG - rank: 4 acr: 150 gs:80.0 s:BTR 'Bitrue Coin ' volume in btc: 220.45 categories:['erc20'] 2022-02-10 11:01:51 - galaxyscore - DEBUG - rank: 5 acr: 277 gs:79.0 s:VRA 'VERAsity ' volume in btc: 4351.92 categories:[] 2022-02-10 11:01:51 - galaxyscore - DEBUG - rank: 6 acr: 209 gs:79.0 s:LINK 'Chainlink ' volume in btc: 14677.92 categories:['defi', 'erc20', 'dot', 'solana'] 2022-02-10 11:01:51 - galaxyscore - DEBUG - rank: 7 acr: 550 gs:78.5 s:CHR 'Chromia ' volume in btc: 1973.59 categories:['defi', 'erc20', 'nft'] 2022-02-10 11:01:51 - galaxyscore - DEBUG - rank: 8 acr: 173 gs:78.5 s:ADA 'Cardano ' volume in btc: 29615.42 categories:[] 2022-02-10 11:01:51 - galaxyscore - DEBUG - rank: 9 acr: 627 gs:78.0 s:TKP 'TOKPIE ' volume in btc: 0.40 categories:['erc20'] 2022-02-10 11:01:51 - galaxyscore - DEBUG - rank: 10 acr: 365 gs:78.0 s:HOT 'Holo ' volume in btc: 1940.24 categories:['erc20']

RASPBERRY PI OUTPUT:

2022-02-10 11:19:36 - galaxyscore - DEBUG - https://api.lunarcrush.com:443 "GET /v2?data=market&type=fast&sort=gs&limit=150&key=xxxxx HTTP/1.1" 200 45333 2022-02-10 11:19:37 - galaxyscore - DEBUG - rank: 1 acr:1420 gs:0.0 vt:0.000000 s:RISE2 'Rise ' volume in btc: 0.70 categories:[] 2022-02-10 11:19:37 - galaxyscore - DEBUG - rank: 2 acr:2328 gs:0.0 vt:0.000000 s:WSD 'Where's Dev? ' volume in btc: 0.00 categories:['bsc', 'defi'] 2022-02-10 11:19:37 - galaxyscore - DEBUG - rank: 3 acr:2329 gs:0.0 vt:0.000000 s:FXRS 'Fixers ' volume in btc: 0.00 categories:['bsc', 'defi', 'nft'] 2022-02-10 11:19:37 - galaxyscore - DEBUG - rank: 4 acr:2330 gs:0.0 vt:0.000000 s:EDDCOIN 'EDDCOIN ' volume in btc: 0.00 categories:['meme'] 2022-02-10 11:19:37 - galaxyscore - DEBUG - rank: 5 acr:2450 gs:0.0 vt:0.000000 s:WWB 'Wowbit ' volume in btc: 0.01 categories:[] 2022-02-10 11:19:37 - galaxyscore - DEBUG - rank: 6 acr:2462 gs:0.0 vt:0.000000 s:ETHFIN 'Ethernal Finance ' volume in btc: 0.00 categories:['bsc', 'defi'] 2022-02-10 11:19:37 - galaxyscore - DEBUG - rank: 7 acr:2488 gs:0.0 vt:0.000000 s:TON2 'TON Crystal ' volume in btc: 4.80 categories:['defi', 'dot'] 2022-02-10 11:19:37 - galaxyscore - DEBUG - rank: 8 acr:2534 gs:0.0 vt:0.000000 s:OF 'OFCOIN ' volume in btc: 1.02 categories:[] 2022-02-10 11:19:37 - galaxyscore - DEBUG - rank: 9 acr:2542 gs:0.0 vt:0.000000 s:DAGT 'Digital Asset Guarantee Token' volume in btc: 9.11 categories:['erc20'] 2022-02-10 11:19:37 - galaxyscore - DEBUG - rank: 10 acr:2544 gs:0.0 vt:0.000000 s:FOX2 'SmartFox ' volume in btc: 4.55 categories:[]

  1. Anything else what is important

Ive found that the raspberry pi is not including the "desc=True" when fetching lunarCrush ranking.

Expected behavior

Get the real LunarCrush GalaxyScore ranking top coins.

Screenshots none

Environment:

Python 3.9.2

Linux bigBro 5.10.63-v7+ #1459 SMP Wed Oct 6 16:41:10 BST 2021 armv7l GNU/Linux

0.9.0

Additional context Running OK on my Windows laptop, failing on my raspi 3.

chespix commented 2 years ago

I've found that while the version is 0.9.0 on both computers, the raspberry PI has a newer code. After updating code from repo on my computer, I get the same error.

Ive fixed it adding the following line to helpers/misc.py file. Not sure if proper fix, but using this as a workaround.

.....

Construct query for LunarCrush data

if "altrank" in program:
    parms = {
        "data": "market",
        "type": "fast",
        "sort": "acr",
        "limit": lcfetchlimit,
        "key": lcapikey,
    }
elif "galaxyscore" in program:
    parms = {
        "data": "market",
        "type": "fast",
        "sort": "gs",
        "limit": lcfetchlimit,
        "key": lcapikey,
        **"desc": True,**
    }

.....

cyberjunky commented 2 years ago

@chespix thanks for reporting, I fixed it in last code

chespix commented 2 years ago

thank you! awesome script. KUDOS!