publish feed price automatic(From BitSuperLab)

Started by alt, August 28, 2014, 02:18:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alt

Quote from: svk on November 25, 2014, 08:22:31 PM
@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


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

monsterer

Progress:

./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.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

monsterer

Just saw the notice about python3.

Now i'm getting this error:

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.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

alt

thanks, I forgot to update the link, rename btsx to bts

Quote from: emski on November 25, 2014, 07:33:09 AM
Quote from: alt on November 25, 2014, 01:28:09 AM
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.

monsterer

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

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

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?

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.
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

emski

Quote from: alt on November 25, 2014, 01:28:09 AM
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.
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

alt

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


emski

Quote from: xeroc on November 11, 2014, 05:14:53 PM
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.
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

xeroc

Agreed ...
But i didn not merge your changes to the update rule and some others ... just the exchange importance and some error handling ..

emski

Quote from: xeroc on November 11, 2014, 04:14:39 PM
@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.
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

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

emski

#78
Quote from: Vato_ on November 11, 2014, 03:57:52 PM

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
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

xeroc

Quote from: Vato_ on November 11, 2014, 02:54:59 PM
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!

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