Author Topic: publish feed price automatic(From BitSuperLab)  (Read 40392 times)

0 Members and 1 Guest are viewing this topic.

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
seems not work until now?

来自我的 HUAWEI P7-L00 上的 Tapatalk


Offline svk

@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
Worker: dev.bitsharesblocks

Offline monsterer

Progress:

Code: [Select]
./bts_feed_auto.py
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 11, in <module>
    import exchanges as ex
  File "/root/bitshares/operation_tools/btsfeed/exchanges/__init__.py", line 1, in <module>
    from exchanges.exchanges import Exchanges
  File "/root/bitshares/operation_tools/btsfeed/exchanges/exchanges.py", line 5, in <module>
    import statistics
ImportError: No module named 'statistics'

?
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline monsterer

Just saw the notice about python3.

Now i'm getting this error:

Code: [Select]
python3 bts_feed_auto.py
  File "bts_feed_auto.py", line 93
    print "Warnning: rpc call error, retry 5 seconds later"
                                                          ^
SyntaxError: invalid syntax

Any ideas?
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
thanks, I forgot to update the link, rename btsx to bts

have updated:

    1. need python3 now
    2.  please modify config.json,  sample file is config-sample.json
    3. now I computer feed price with weight, weight depends on depth, and scale.
        support 5 exchange: btc38, yunbi, bter, BTS USD MARKET, BTS CNY MARKET
        please use  different scale, change file config.json

The link in OP to the github repo returns 404.

Offline monsterer

I'm having trouble getting this script to talk to bitshares through the RPC.

I have confirmed that doing this, yields a positive result:

Code: [Select]
curl --user `grep rpc_user ~/.BitShares/config.json | cut -d ":" -f 2 | tr -d " \",\n"`:`grep rpc_password ~/.BitShares/config.json | cut -d ":" -f 2 | tr -d " \",\n"` --data-binary '{"method":"about", "params": [], "json-rpc": 2.0, "id": 0}' -H 'content-type: text/plain;' http://localhost:9989/rpc
Yet every call to the feeds script results in an error about zero parameters and I can't even ctrl-c the script to stop it running. Any advice about how to diagnose this?

Code: [Select]
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 272, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 221, in fetch_price
    print '{: >6}'.format("ASSET"), '{: >10}'.format("MEDIAN"), '{: >10}'.format("PUBLISH"), '{: >10}'.format("REAL"),'{: >8}'.format("CHANGE"),'{: >16}'.format("RATE(CNY/ASSET)"), "| CURRENT PRICE", time.strftime("(%Y%m%dT%H%M%S)", time.localtime(time.time()))
ValueError: zero length field name in format

p.s. I have configured the config script with the correct rpc username and password.
« Last Edit: November 25, 2014, 12:18:59 pm by monsterer »
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline emski

  • Hero Member
  • *****
  • Posts: 1282
    • View Profile
    • http://lnkd.in/nPbhxG
have updated:

    1. need python3 now
    2.  please modify config.json,  sample file is config-sample.json
    3. now I computer feed price with weight, weight depends on depth, and scale.
        support 5 exchange: btc38, yunbi, bter, BTS USD MARKET, BTS CNY MARKET
        please use  different scale, change file config.json

The link in OP to the github repo returns 404.

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
have updated:

    1. need python3 now
    2.  please modify config.json,  sample file is config-sample.json
    3. now I computer feed price with weight, weight depends on depth, and scale.
        support 5 exchange: btc38, yunbi, bter, BTS USD MARKET, BTS CNY MARKET
        please use  different scale, change file config.json


Offline emski

  • Hero Member
  • *****
  • Posts: 1282
    • View Profile
    • http://lnkd.in/nPbhxG
Agreed ...
But i didn not merge your changes to the update rule and some others ... just the exchange importance and some error handling ..

I'll keep mine up to date then. I'd like to be able to use my update rule.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Agreed ...
But i didn not merge your changes to the update rule and some others ... just the exchange importance and some error handling ..

Offline emski

  • Hero Member
  • *****
  • Posts: 1282
    • View Profile
    • http://lnkd.in/nPbhxG
@emski .. i added the exchange confidence to my script too

@vato_: please compare you config.json with the example config.json in the directory

If you've merged my changes then we dont need to maintain 2 versions of the script.
The diversity is achieved via the configuration where each delegate can configure its trust into exchanges.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
@emski .. i added the exchange confidence to my script too

@vato_: please compare you config.json with the example config.json in the directory

Offline emski

  • Hero Member
  • *****
  • Posts: 1282
    • View Profile
    • http://lnkd.in/nPbhxG

OK so far.  ;)
"python3 bts_feed_auto.py GOLD
Loading data: yahoo, BTC38Traceback (most recent call last):
  File "bts_feed_auto.py", line 410, in <module>
    fetch_from_btc38()
  File "bts_feed_auto.py", line 72, in fetch_from_btc38
    if "ticker" in result[coin.lower()] and result[coin.lower()]["ticker"] and float(result[coin.lower()]["ticker"]["last"])>config["minValidAssetPrice"]:
KeyError: 'minValidAssetPrice'
"
Should be this the expected result?

Looks like you are using my version of the script. It is not yet working on 0.4.24. I'll update it soon.
Details: https://bitsharestalk.org/index.php?topic=9698.0
« Last Edit: November 11, 2014, 04:09:09 pm by emski »

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Edit: with xeroc's script I get "Traceback (most recent call last):
  File "/root/bts_feed/bts_feed_auto.py", line 4, in <module>
    import requests
ImportError: No module named 'requests'
"

my script requires python3! and as such you need to also install requests for python3!

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
if you want to publish the feed for GOLD you have to rename GLD to GOLD in the arguments of the script ..

python script.py USD EUR GOLD SILVER CNY