Main Menu

Yet Another Price Feed Mod

Started by emski, October 04, 2014, 11:42:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

toast

Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

emski

Actually I've updated the script to work with 0.4.25.
You can safely update now.
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

emski

#20
Quote from: svk on December 12, 2014, 10:17:04 AM
Think we need an update to handle the new date format, "oldtime" is no longer parsed correctly.  This seems to work but I'm not 100% sure:

oldtime[ f[ "asset_symbol" ] ] = datetime.strptime(f["last_update"],"%Y-%m-%dT%H:%M:%S")

I'll look into it after work. For now you can use the feed through the old client.
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

svk

Think we need an update to handle the new date format, "oldtime" is no longer parsed correctly.  This seems to work but I'm not 100% sure:

oldtime[ f[ "asset_symbol" ] ] = datetime.strptime(f["last_update"],"%Y-%m-%dT%H:%M:%S")
Worker: dev.bitsharesblocks

emski

I've pushed a fix to handle the btsx->bts name change on btc38 .

[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

emski

I've pushed a check for malformed exchange reply (btc38 only for now).
It appears that there is an issue with btc38.
I'll investigate further tomorrow as it is 2:00 am here and I've driven about 600 km on Bulgarian roads today.
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

xeroc

#16
Quote from: emski on November 15, 2014, 01:16:53 AM
Quote from: kokojie on November 15, 2014, 01:14:24 AM
cool, emski yours is working for me now

The error in xeroc's script you see might be related to improper config file.
There are different variables in both versions. Make sure you use proper version.
example:


{                                                                                                                                       
  "bts_rpc": {
    "url": "http://10.0.0.16:19988/rpc",
    "username": ""
    "password": ""
  }, 
  "delegate_list": [ "delegate.xeroc"],
  "payaccount" : "delegate.xeroc",
  "maxAgeFeedInSeconds" : 2700,
  "minValidAssetPrice" : 0.00001,
  "discount" : 0.995,
  "change_min" : 0.5,
  "btc38_trust_level" : 0.7,
  "bter_trust_level" : 1.0,
  "poloniex_trust_level" : 0.5,
  "bittrex_trust_level" : 0.5
}



emski

Quote from: kokojie on November 15, 2014, 01:14:24 AM
cool, emski yours is working for me now

The error in xeroc's script you see might be related to improper config file.
There are different variables in both versions. Make sure you use proper version.
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

kokojie

cool, emski yours is working for me now

emski

My bad. I've committed not working version.
Should be OK now.
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

emski

Quote from: kokojie on November 15, 2014, 12:51:25 AM
I still get errors with both emski and xeroc's updated script:

emski:
  File "./btsx_feed.py", line 125
    volume_in_btc[ mapAsset ].append(float(result[coin.lower()+"_btc"]["vol_btc"])*confi$
                                                                                                                                           ^
SyntaxError: invalid syntax


xeroc:
  File "/home/user/feed_xeroc/btsx_feed.py", line 433, in <module>
    if publish_rule() :
  File "/home/user/feed_xeroc/btsx_feed.py", line 47, in publish_rule
    elif fabs(myCurrentFeed[asset]-realPrice[asset])/realPrice[asset] > config["change_min"] and\
KeyError: 'change_min'

What arguments are you passing to the scripts ?
Example: "./btsx_feed.py GOLD BTC USD CNY EUR"

Are you sure you have the file as in github ?
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

kokojie

I still get errors with both emski and xeroc's updated script:

emski:
  File "./btsx_feed.py", line 125
    volume_in_btc[ mapAsset ].append(float(result[coin.lower()+"_btc"]["vol_btc"])*confi$
                                                                                                                                           ^
SyntaxError: invalid syntax


xeroc:
  File "/home/user/feed_xeroc/btsx_feed.py", line 433, in <module>
    if publish_rule() :
  File "/home/user/feed_xeroc/btsx_feed.py", line 47, in publish_rule
    elif fabs(myCurrentFeed[asset]-realPrice[asset])/realPrice[asset] > config["change_min"] and\
KeyError: 'change_min'

xeroc

Quote from: emski on November 13, 2014, 09:05:27 PM
Apparently BTER changed BTSX asset name to BTS.
I've pushed a quick patch to address that.
I'll try to make something more robust soon.
dito ... had my inbox filled with errors .. need to put hand on the script some more ..

emski

Apparently BTER changed BTSX asset name to BTS.
I've pushed a quick patch to address that.
I'll try to make something more robust soon.
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

emski

I've updated with changes related to v0.4.24 .
I've merged some bugfixes (thanks to xeroc (python identation is tricky)).
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]