BitShares Forum

Main => General Discussion => Topic started by: alt on August 28, 2014, 02:18:26 am

Title: publish feed price automatic(From BitSuperLab)
Post by: alt on August 28, 2014, 02:18:26 am
https://github.com/Bitsuperlab/operation_tools/tree/master/btsfeed (https://github.com/Bitsuperlab/operation_tools/tree/master/btsfeed)

how to use this script?

1.    cp config.json.sample to config.json

    edit the rpc parameter, delegate-list ...

2.    if you just want to watch the price, run command without parameter, update every 1 minute

    ./btsx_feed_auto.py

3.    if you want to publish feed,run command with the asset lists, like:

    ./btsx_feed_auto.py USD CNY GLD

    this will update price every 1 minute, and publish the feed price automatic if the change is more than 5% and less than 50%(this value can custom with config.json)
    and will publish at least 23.5 hours,because the feed price will expired after 24 hours.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: muse-umum on August 28, 2014, 02:36:36 am
For those delegates who have published the BitCNY price feed, please update your fed price ASAP. We have reached 46 delegates now.

I can see some prices are not so reasonable.

You may try to use alt's program to update the price feed every time when the price moves up or down by 5% (make sure you have enough funds in your wallet). 

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on August 28, 2014, 07:50:06 am
2.    if you just want to watch the price, run command without parameter, update every 1 minute

    ./btsx_feed_auto.py
Code: [Select]
~/operation_tools/btsxfeed$ python2 btsx_feed.py BTC USD CNY
Fetch: rate usd/cny 6.1451
Fetch: rate xau/cny 7920.2964
BTC : [7.87e-05, 7.321e-05] ,average: 7.5955e-05
USD : [0.03677726969455338, 0.03666335779726937] ,average: 0.0367203137459
CNY : [0.226, 0.2253] ,average: 0.22565
do you want to update the feed?(y/n):y
Traceback (most recent call last):
  File "btsx_feed.py", line 135, in <module>
    update_feed()
TypeError: update_feed() takes exactly 2 arguments (0 given)


fixed with:
Code: [Select]
134 if confirm():
135  for asset in asset_list_publish:
136    if len(price[asset]) > 0:
137     update_feed(price_average[asset], asset)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on August 28, 2014, 12:06:21 pm
2.    if you just want to watch the price, run command without parameter, update every 1 minute

    ./btsx_feed_auto.py
Code: [Select]
~/operation_tools/btsxfeed$ python2 btsx_feed.py BTC USD CNY
Fetch: rate usd/cny 6.1451
Fetch: rate xau/cny 7920.2964
BTC : [7.87e-05, 7.321e-05] ,average: 7.5955e-05
USD : [0.03677726969455338, 0.03666335779726937] ,average: 0.0367203137459
CNY : [0.226, 0.2253] ,average: 0.22565
do you want to update the feed?(y/n):y
Traceback (most recent call last):
  File "btsx_feed.py", line 135, in <module>
    update_feed()
TypeError: update_feed() takes exactly 2 arguments (0 given)


fixed with:
Code: [Select]
134 if confirm():
135  for asset in asset_list_publish:
136    if len(price[asset]) > 0:
137     update_feed(price_average[asset], asset)
thx
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: puppies on August 28, 2014, 08:06:56 pm
When it comes time for this to publish my feed I get
Code: [Select]
Warnning: Can't connect to rpc server, retry 5 seconds latermy btsxfeed config JSON looks like this
Code: [Select]
{
  "bts_rpc": {
    "url": "http://localhost:9989/rpc",
    "username": "user",
    "password": "pass"
  },
  "asset_list_display": ["CNY", "USD", "BTC"],
  "delegate_list": ["dele-puppy"]
}
and my bitshares_client config.json looks like this
Code: [Select]
{
  "rpc": {
    "enable": false,
    "rpc_user": "user",
    "rpc_password": "pass",
    "rpc_endpoint": "127.0.0.1:9989",
    "httpd_endpoint": "127.0.0.1:0",
    "htdocs": "./htdocs"
  },

Any idea what I am doing wrong?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on August 28, 2014, 08:13:06 pm
Yhea. .. switch the port over to

"httpd_endpoint": "127.0.0.1:9988",

and leave the RPC with something welse
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: puppies on August 28, 2014, 08:33:34 pm
Yhea. .. switch the port over to

"httpd_endpoint": "127.0.0.1:9988",

and leave the RPC with something welse

Still the same error, but at least now it isn't locking up my delegate and killing it.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on August 28, 2014, 11:39:59 pm
the port number is depend on parameter --httpport
and the username/password  depend on parameter --rpcuser/--rpcpassword
for example, here is the command line work for the sample configure.json
Code: [Select]
./bitshares_client  --server --httpport 9989 --rpcuser user --rpcpassword pass

When it comes time for this to publish my feed I get
Code: [Select]
Warnning: Can't connect to rpc server, retry 5 seconds latermy btsxfeed config JSON looks like this
Code: [Select]
{
  "bts_rpc": {
    "url": "http://localhost:9989/rpc",
    "username": "user",
    "password": "pass"
  },
  "asset_list_display": ["CNY", "USD", "BTC"],
  "delegate_list": ["dele-puppy"]
}
and my bitshares_client config.json looks like this
Code: [Select]
{
  "rpc": {
    "enable": false,
    "rpc_user": "user",
    "rpc_password": "pass",
    "rpc_endpoint": "127.0.0.1:9989",
    "httpd_endpoint": "127.0.0.1:0",
    "htdocs": "./htdocs"
  },

Any idea what I am doing wrong?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on August 28, 2014, 11:42:09 pm



I was messing with this for a bit today on my Delegate server. Couldn't get it to connect. I put in some debug lines so I could tell exactly where it was failing. It was on the response.post(). The rpc log never showed any activity either. More playing tomorrow :).



the port number is depend on parameter --httpport
and the username/password  depend on parameter --rpcuser/--rpcpassword
for example, here is the command line work for the sample configure.json
Code: [Select]
./bitshares_client  --server --httpport 9989 --rpcuser user --rpcpassword pass

When it comes time for this to publish my feed I get
Code: [Select]
Warnning: Can't connect to rpc server, retry 5 seconds latermy btsxfeed config JSON looks like this
Code: [Select]
{
  "bts_rpc": {
    "url": "http://localhost:9989/rpc",
    "username": "user",
    "password": "pass"
  },
  "asset_list_display": ["CNY", "USD", "BTC"],
  "delegate_list": ["dele-puppy"]
}
and my bitshares_client config.json looks like this
Code: [Select]
{
  "rpc": {
    "enable": false,
    "rpc_user": "user",
    "rpc_password": "pass",
    "rpc_endpoint": "127.0.0.1:9989",
    "httpd_endpoint": "127.0.0.1:0",
    "htdocs": "./htdocs"
  },

Any idea what I am doing wrong?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on August 29, 2014, 12:03:00 am
ah, I see
maybe you should config like this
1. enable rpc
2. in fact, we request rpc service from the http server,
so we need to configure the httpd port.....
Code: [Select]
{
  "rpc": {
    "enable": true,
    "rpc_user": "user",
    "rpc_password": "pass",
    "rpc_endpoint": "127.0.0.1:0",
    "httpd_endpoint": "127.0.0.1:9989",
    "htdocs": "./htdocs"
  },
here is the command to check if rpc server is listening  at the right port , you should see a line with port 9989 available
Code: [Select]
alt@localhost:~/workspace/bitsuperlab/blockchain$ netstat -nlp | grep bitshares
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:1777            0.0.0.0:*               LISTEN      30896/bitshares_cli
tcp        0      0 0.0.0.0:1976            0.0.0.0:*               LISTEN      11434/bitshares_cli
tcp        0      0 127.0.0.1:58075         0.0.0.0:*               LISTEN      30896/bitshares_cli
tcp        0      0 127.0.0.1:57885         0.0.0.0:*               LISTEN      11434/bitshares_cli
tcp        0      0 127.0.0.1:9988          0.0.0.0:*               LISTEN      11434/bitshares_cli
tcp        0      0 127.0.0.1:9989          0.0.0.0:*               LISTEN      30896/bitshares_cli
When it comes time for this to publish my feed I get
Code: [Select]
Warnning: Can't connect to rpc server, retry 5 seconds latermy btsxfeed config JSON looks like this
Code: [Select]
{
  "bts_rpc": {
    "url": "http://localhost:9989/rpc",
    "username": "user",
    "password": "pass"
  },
  "asset_list_display": ["CNY", "USD", "BTC"],
  "delegate_list": ["dele-puppy"]
}
and my bitshares_client config.json looks like this
Code: [Select]
{
  "rpc": {
    "enable": false,
    "rpc_user": "user",
    "rpc_password": "pass",
    "rpc_endpoint": "127.0.0.1:9989",
    "httpd_endpoint": "127.0.0.1:0",
    "htdocs": "./htdocs"
  },

Any idea what I am doing wrong?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: puppies on August 29, 2014, 12:06:11 am
Yeah.  I tried that too.  Running with --server should override that anyways as the command line should override the config.json .  Right?  I'm at work now but I'll try it when I get home.  If I get a chance I'll try it on my vps as well.  I've only tried it on my personal computer and I was also running an instance of the qt wallet.  I can't imagine that would affect it though.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on August 29, 2014, 01:02:17 am
sorry for the confuse, I have update the file readme.md
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on August 29, 2014, 10:36:15 am
For those delegates who have published the BitCNY price feed, please update your fed price ASAP. We have reached 46 delegates now.

I can see some prices are not so reasonable.

You may try to use alt's program to update the price feed every time when the price moves up or down by 5% (make sure you have enough funds in your wallet).


Updated. I'm still having trouble getting an RPC connection to my delegate but I'm updating manually. Just having the btsx_feed_auto.py running in a terminal is very useful until I get it working.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on August 29, 2014, 10:43:31 am
Alt, here is my setup. I'm wondering if it's an iptables issue. I'm going to keep poking at it but if anything jumps out let me know.


BitSharesX setup:
Code: [Select]

{
  "rpc": {
    "enable": true,
    "rpc_user": "test",
    "rpc_password": "testy",
    "rpc_endpoint": "127.0.0.1:0",
    "httpd_endpoint": "127.0.0.1:1579",
    "htdocs": "./htdocs"
  }


btsxfeed setup:
Code: [Select]

{
  "bts_rpc": {
    "url": "127.0.0.1:1579",
    "username": "test",
    "password": "testy"
  },
  "asset_list_display": ["CNY", "USD", "BTC"],
  "delegate_list": ["riverhead-del-server-1"]
}


netstat:
Code: [Select]

 netstat -nlp | grep bitshares
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:40544           0.0.0.0:*               LISTEN      10892/bitshares_cli
tcp        0      0 127.0.0.1:1578          0.0.0.0:*               LISTEN      10892/bitshares_cli
tcp        0      0 127.0.0.1:1579          0.0.0.0:*               LISTEN      10892/bitshares_cli


btsx_feed_auto.py output
Code: [Select]

 ./btsx_feed_auto.py BTC CNY USD
Fetch: rate usd/cny 6.1433
Fetch: rate xau/cny 7895.0625


================= 20140829T063459 ==================
Warning: unknown error
Warning: unknown error
Fetch: CNY [0.1466, 0.14959] ,ave: 0.148095 ,change: 100.0 %
Warnning: Can't connect to rpc server, retry 5 seconds later
Warnning: Can't connect to rpc server, retry 5 seconds later
^CTraceback (most recent call last):
  File "./btsx_feed_auto.py", line 144, in <module>
    fetch_price()
  File "./btsx_feed_auto.py", line 130, in fetch_price
    update_feed(price_average[asset], asset)
  File "./btsx_feed_auto.py", line 105, in update_feed
    time.sleep(5)
KeyboardInterrupt

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on August 31, 2014, 05:58:03 am
try to print the responce after  call requests.post.
Alt, here is my setup. I'm wondering if it's an iptables issue. I'm going to keep poking at it but if anything jumps out let me know.


BitSharesX setup:
Code: [Select]

{
  "rpc": {
    "enable": true,
    "rpc_user": "test",
    "rpc_password": "testy",
    "rpc_endpoint": "127.0.0.1:0",
    "httpd_endpoint": "127.0.0.1:1579",
    "htdocs": "./htdocs"
  }


btsxfeed setup:
Code: [Select]

{
  "bts_rpc": {
    "url": "127.0.0.1:1579",
    "username": "test",
    "password": "testy"
  },
  "asset_list_display": ["CNY", "USD", "BTC"],
  "delegate_list": ["riverhead-del-server-1"]
}


netstat:
Code: [Select]

 netstat -nlp | grep bitshares
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:40544           0.0.0.0:*               LISTEN      10892/bitshares_cli
tcp        0      0 127.0.0.1:1578          0.0.0.0:*               LISTEN      10892/bitshares_cli
tcp        0      0 127.0.0.1:1579          0.0.0.0:*               LISTEN      10892/bitshares_cli


btsx_feed_auto.py output
Code: [Select]

 ./btsx_feed_auto.py BTC CNY USD
Fetch: rate usd/cny 6.1433
Fetch: rate xau/cny 7895.0625


================= 20140829T063459 ==================
Warning: unknown error
Warning: unknown error
Fetch: CNY [0.1466, 0.14959] ,ave: 0.148095 ,change: 100.0 %
Warnning: Can't connect to rpc server, retry 5 seconds later
Warnning: Can't connect to rpc server, retry 5 seconds later
^CTraceback (most recent call last):
  File "./btsx_feed_auto.py", line 144, in <module>
    fetch_price()
  File "./btsx_feed_auto.py", line 130, in fetch_price
    update_feed(price_average[asset], asset)
  File "./btsx_feed_auto.py", line 105, in update_feed
    time.sleep(5)
KeyboardInterrupt
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on August 31, 2014, 05:59:06 am
update to github.

update the feed price at least every 23.5 hours. because the feed price will expired after 24 hours.

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on August 31, 2014, 06:43:19 am
updated:
now we can set up a price change limit with config.json
in case that exchange return a very stupid price.
the default limit is 5%~50%
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on September 05, 2014, 02:06:35 am
updated:
1. update config file
2. use median price to replace average price, to protect system from  a suddenly drop price with a short period at the central trade site.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: mtang on September 05, 2014, 08:49:44 am
Great job. +5%
I'm using this tool and it looks like very steady.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: cryptillionaire on September 05, 2014, 10:41:29 pm
Hey,

What are the limits of publishing price feeds to btsx as a delegate?
Can this script be scaled up to provide dozens of price feeds? Or is there a limit?
Eli5 how price feeds work? :S

Cheers :)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: amencon on September 06, 2014, 02:27:57 am
Hey,

What are the limits of publishing price feeds to btsx as a delegate?
Can this script be scaled up to provide dozens of price feeds? Or is there a limit?
Eli5 how price feeds work? :S

Cheers :)
It's dynamic in that you can set a change_min and change_max threshold, when the script polls the prices and seeing a change that fits in the range you set it publishes the new price.  On top of that you can set a periodic time countdown where it will publish the price on a schedule.  So currently I have my script setup to publish the feeds if prices go over 1% and under 50% change and also every 4 hours regardless of price activity.

As far as how many feeds it can monitor and update, skimming the script I see nothing that would limit how many are allowed.  When a price is published it is a separate RPC call with normal fee so the script just runs through the feeds and publishes them one by one when the criteria matches.

Let us know if you need any help customizing the script, it is very simple and just some variables that need changing.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on September 15, 2014, 04:37:29 am
have update btsx_feed_auto.py, now support more asset except: "PTS", "PPC", "LTC", "WTI"
I don't know how to get WTI  from yahoo.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: busygin on September 15, 2014, 05:49:32 am
Please be careful with WTI. Usually websites publish the front month contract as the current oil price, and each time the front month expires, there is a roll to the next month with a different price. I already wrote about this issue here:
https://bitsharestalk.org/index.php?topic=8679.msg113184#msg113184

I don't know how to get WTI and SLV from yahoo.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on September 15, 2014, 06:38:36 am
thanks, this looks so complex, I still have no idea about this...
Please be careful with WTI. Usually websites publish the front month contract as the current oil price, and each time the front month expires, there is a roll to the next month with a different price. I already wrote about this issue here:
https://bitsharestalk.org/index.php?topic=8679.msg113184#msg113184

I don't know how to get WTI and SLV from yahoo.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on September 15, 2014, 11:09:14 am
alt - There is a new command called wallet_update_feeds that publishes all feeds as one transaction. Will your code be updated to this? It would make for more accurate price feeds as when one feed needs updating they all get refreshed. With this command there's no reason every delegate won't support feeds for every pair!  :o



wallet_publish_feeds
Usage:
wallet_publish_feeds <delegate_account> <symbol_to_price_map>                                         
publishes a set of feeds for BitAssets, only active delegates may do this

Parameters:
  delegate_account (account_name, required): the delegate to publish the price under
  symbol_to_price_map (price_map, required): maps the BitAsset symbol to the price per BTSX

Returns:
  transaction_record


Thanks!!
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on September 15, 2014, 11:36:56 am
https://github.com/dacsunlimited/bitsharesx/commit/94a9c9af095d28e0795c0132e3537ccc2478a926

requires     v0.4.15-a

that's why I am not seeing it ... yet


I was wrong ... command is called "wallet_publish_feeds" and "wallet_publish_price_feed" .. little confusing .. (inconsistent)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on September 15, 2014, 11:43:58 am
While you're in there making changes any chance bitUSD/BTSX Bid/Ask/Short tables can be updated to USD/BTSX (0.036 vs 25.0) like the other bitUSD stats? Would make it much easier to read :).
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on September 15, 2014, 11:48:37 am
While you're in there making changes any chance bitUSD/BTSX Bid/Ask/Short tables can be updated to USD/BTSX (0.036 vs 25.0) like the other bitUSD stats? Would make it much easier to read :).
there is a little button next to the bitUSD/BTSX on the top ... that makes the market swap/flip

should read more before posting .. sry
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on September 15, 2014, 11:51:23 am
While you're in there making changes any chance bitUSD/BTSX Bid/Ask/Short tables can be updated to USD/BTSX (0.036 vs 25.0) like the other bitUSD stats? Would make it much easier to read :) .
there is a little button next to the bitUSD/BTSX on the top ... that makes the market swap/flip


That's on the client, not his website. Or is the button just not showing?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on September 15, 2014, 11:26:48 pm
I have try to use this command, but it's failed, do you know how to use this?
Code: [Select]
delegate (unlocked) >>> wallet_publish_feeds delegate.baozi {"USD":0.033,"CNY":0.204}
7 bad_cast_exception: Bad Cast
Invalid cast from object_type to Array
    {"type":"object_type"}
    th_a  variant.cpp:463 get_array

    {"command":"wallet_publish_feeds"}
    th_a  cli.cpp:555 execute_command

alt - There is a new command called wallet_update_feeds that publishes all feeds as one transaction. Will your code be updated to this? It would make for more accurate price feeds as when one feed needs updating they all get refreshed. With this command there's no reason every delegate won't support feeds for every pair!  :o



wallet_publish_feeds
Usage:
wallet_publish_feeds <delegate_account> <symbol_to_price_map>                                         
publishes a set of feeds for BitAssets, only active delegates may do this

Parameters:
  delegate_account (account_name, required): the delegate to publish the price under
  symbol_to_price_map (price_map, required): maps the BitAsset symbol to the price per BTSX

Returns:
  transaction_record


Thanks!!
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Xeldal on September 16, 2014, 12:15:57 am
From another thread. If you havn't already seen it.

@xeroc:
It took me some trial and error before I could work out the proper syntax.  Here is my latest update:
Code: [Select]
wallet_publish_feeds fox [["USD",0.0341],["CNY",0.2040]]
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on September 16, 2014, 01:41:38 am
thanks, I have update the script to use wallet_publish_feeds
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on September 16, 2014, 01:42:55 am
thanks, I have update the script to use wallet_publish_feeds

Awesome!
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: maqifrnswa on September 16, 2014, 02:05:59 am
I'm using it, it works!

could it accept the command line arg "ALL""
Code: [Select]
./btsx_feed_auto.py ALL
where all would do all available feeds? Now that we have the green light to fire up more markets and there is no cost to do additional feeds, we don't need to be picky any more.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on September 16, 2014, 02:09:58 am

could it accept the command line arg "ALL""
Code: [Select]
./btsx_feed_auto.py ALL
where all would do all available feeds? Now that we have the green light to fire up more markets and there is no cost to do additional feeds, we don't need to be picky any more.
+5% +5% +5%
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on September 16, 2014, 02:47:16 am
ok, support param ALL now,   not support these 4 assets for now: PTS, PPC, LTC, WTI
Code: [Select]
alt@alt-ThinkPad-T430s ~/workspace/bitsuperlab/btsxfeed $ ./btsx_feed_auto.py ALL                                                                                       
Fetch: rate  PTS 0.0
Fetch: rate  PPC 0.0
Fetch: rate  LTC 0.0
Fetch: rate  BTC 2917.2368
Fetch: rate  WTI 0.0
Fetch: rate  SLV 114.3235
Fetch: rate  GLD 7620.2324
Fetch: rate  TRY 2.7861
Fetch: rate  SGD 4.8803
Fetch: rate  HKD 0.7949
Fetch: rate  RUB 0.1606
Fetch: rate  SEK 0.8669
Fetch: rate  NZD 5.0439
Fetch: rate  CNY 1.0
Fetch: rate  MXN 0.466
Fetch: rate  CAD 5.5776
Fetch: rate  CHF 6.5943
Fetch: rate  AUD 5.5718
Fetch: rate  GBP 10.0058
Fetch: rate  JPY 0.0576
Fetch: rate  EUR 7.9777
Fetch: rate  USD 6.161

================= 20140916T104454 ==================

Warning: can't get price of PTS
Warning: can't get price of PPC
Warning: can't get price of LTC
Fetch: BTC [6.87e-05, 6.975779271672426e-05, 6.945e-05, 7.088900016618466e-05] ,median: 6.97577927167e-05 ,change: 0.0 %
Warning: can't get price of WTI
Fetch: SLV [0.0017800364754403076, 0.0018089019317987993] ,median: 0.0018089019318 ,change: 0.0 %
Fetch: GLD [2.6705222271173776e-05, 2.7138279929625246e-05] ,median: 2.71382799296e-05 ,change: 0.0 %
Fetch: TRY [0.07304116865869854, 0.07422562004235311] ,median: 0.0742256200424 ,change: 0.0 %
Fetch: SGD [0.041698256254738435, 0.04237444419400447] ,median: 0.042374444194 ,change: 0.0 %
Fetch: HKD [0.25600704491130954, 0.260158510504466] ,median: 0.260158510504 ,change: 0.0 %
Fetch: RUB [1.2671232876712328, 1.2876712328767124] ,median: 1.28767123288 ,change: 0.0 %
Fetch: SEK [0.2347444918675741, 0.2385511593032645] ,median: 0.238551159303 ,change: 0.0 %
Fetch: NZD [0.040345764190408216, 0.04100001982592835] ,median: 0.0410000198259 ,change: 0.0 %
Fetch: CNY [0.2035, 0.2035, 0.2068, 0.2068] ,median: 0.2068 ,change: 0.0 %
Fetch: MXN [0.436695278969957, 0.44377682403433477] ,median: 0.443776824034 ,change: 0.0 %
Fetch: CAD [0.036485226620768786, 0.03707687894434882] ,median: 0.0370768789443 ,change: 0.0 %
Fetch: CHF [0.030859985138680376, 0.03136041733011844] ,median: 0.0313604173301 ,change: 0.0 %
Fetch: AUD [0.03652320614523134, 0.037115474352991853] ,median: 0.037115474353 ,change: 0.0 %
Fetch: GBP [0.02033820384177177, 0.020668012552719422] ,median: 0.0206680125527 ,change: 0.0 %
Fetch: JPY [3.532986111111111, 3.590277777777778] ,median: 3.59027777778 ,change: 0.0 %
Fetch: EUR [0.02550860523709841, 0.025922258294997308] ,median: 0.025922258295 ,change: 0.0 %
Fetch: USD [0.033030352215549424, 0.033565979548774556] ,median: 0.0335659795488 ,change: 0.0 %
Update: delegate.baozi [['BTC', 6.975779271672426e-05], ['SLV', 0.0018089019317987993], ['GLD', 2.7138279929625246e-05], ['TRY', 0.07422562004235311], ['SGD', 0.04237444419400447], ['HKD', 0.260158510504466], ['RUB', 1.2876712328767124], ['SEK', 0.2385511593032645], ['NZD', 0.04100001982592835], ['CNY', 0.2068], ['MXN', 0.44377682403433477], ['CAD', 0.03707687894434882], ['CHF', 0.03136041733011844], ['AUD', 0.037115474352991853], ['GBP', 0.020668012552719422], ['JPY', 3.590277777777778], ['EUR', 0.025922258294997308], ['USD', 0.033565979548774556]]
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on September 16, 2014, 02:52:13 am
 alt you are a rock star.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: maqifrnswa on September 16, 2014, 03:49:33 am
wow  +5%
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: svk on September 16, 2014, 06:35:44 am
Great stuff alt, I can confirm it works with ALL :)

This should greatly increase the number of feeds available!
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on September 16, 2014, 07:23:17 am
we are still missing ~20 feeds for GLD to open up!
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: bitder on September 16, 2014, 01:43:35 pm
ok, support param ALL now, 

Thanks for the script, alt.
I'm using ./btsx_feed_auto.py ALL now
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on September 16, 2014, 02:56:36 pm
ok, support param ALL now, 

Thanks for the script, alt.
I'm using ./btsx_feed_auto.py ALL now


If all the delegates are using alt's code doesn't that sort of defeat the purpose? I guess we could modify his source to use different sources...but there aren't a lot to choose from I guess.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: bitder on September 16, 2014, 03:13:59 pm
If all the delegates are using alt's code doesn't that sort of defeat the purpose? I guess we could modify his source to use different sources...but there aren't a lot to choose from I guess.

The delegates are sampling and updating at different times so the overall median price feed should track the sampled data source (with a lag that's dependent on how frequently the delegates as a group updates the feed).
Obviously, the more delegates sampling the data source and publishing feeds the closer it will track the sampled source.
http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on September 16, 2014, 04:24:39 pm
Also I modified the code to average also over poloniex and bitrex .. and doe some other stuff differently. ..
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: CalabiYau on September 16, 2014, 05:26:08 pm
ok, support param ALL now,   not support these 4 assets for now: PTS, PPC, LTC, WTI

Works o.k. for me, thank you alt
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on September 17, 2014, 12:26:04 am
updated: support PTS,PPC,LTC now
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on September 17, 2014, 06:33:22 am
ui .. +5%
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on September 24, 2014, 07:15:12 am
I change your script a little to have a "different" implementation:
https://github.com/xeroc/pytshares/blob/master/btsx_feed.py

things that are different:
 - no autoreload/just straight single run (cronjob) - maybe I change this in future
 - loads prices from yahoo/btc38/bter/poloniex for all NATIVE currencies of the platform (price_in_cny, price_in_btc,...)
 - convert each available price pair into prices denoted in btsx (convert_all())
 - also get the price for USD/EUR/CNY from bitcoinaverage
 - can set the payee for the feeds if you want someone else to pay the tx fee
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on September 26, 2014, 03:36:31 pm
Actually I think it may be beneficial to discount all feeds by 0.995 to give the market makers some breathing room and provide a buffer against down trends.
delegates, please update the script with new rules bytemaster recommended
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on September 26, 2014, 03:41:35 pm
I change your script a little to have a "different" implementation:
https://github.com/xeroc/pytshares/blob/master/btsx_feed.py

things that are different:
 - no autoreload/just straight single run (cronjob) - maybe I change this in future
 - loads prices from yahoo/btc38/bter/poloniex for all NATIVE currencies of the platform (price_in_cny, price_in_btc,...)
 - convert each available price pair into prices denoted in btsx (convert_all())
 - also get the price for USD/EUR/CNY from bitcoinaverage
 - can set the payee for the feeds if you want someone else to pay the tx fee
I want to change this  to  single run too :)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on September 26, 2014, 05:14:12 pm
I thought about just having a single cronjob be run every 15 minutes or so and just update on "demand" ..
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on September 26, 2014, 05:23:19 pm
Perhaps the idea of continuously running script is a good choice as it can monitor the price movements more closely and publish only when required.
For example:

Fetching data from exchanges and central bank(for USD<->EUR<->CNY ) doing all the conversions and calculations and publish if one of the following conditions is met:
1 Price of any asset falls by X
2 X minutes passed since the last update
3 Price of any asset increases by Y

And as I mentioned in other threads:
Exchange volume should be accounted for in calculations.
Configurable delegate preferences that increase/decrease the weight of any exchange in the calculations.

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: jckj on September 28, 2014, 03:29:58 pm
Well done  +5%
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on October 01, 2014, 10:33:10 pm
its python3 .. you need python3-requests
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: kokojie on October 01, 2014, 10:35:40 pm
its python3 .. you need python3-requests

omg ur so fast, so how do I install these? I already have "apt-get install python"
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on October 01, 2014, 10:36:40 pm
guess
apt-get install python3-requests

I may need to write a installation guide :) ...

gonna go to bed now .. once python module are all installed (most are part of python core) the rest should run with ease
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: GaltReport on October 01, 2014, 10:42:07 pm
its python3 .. you need python3-requests

omg ur so fast, so how do I install these? I already have "apt-get install python"

I ended up using pyenv to install python3 and to switch python environments then created a shell script to call the price feed script from cronjob so the environment was setup right for finding the right python.

https://github.com/yyuu/pyenv

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: kokojie on October 02, 2014, 12:45:43 am
guess
apt-get install python3-requests

I may need to write a installation guide :) ...

gonna go to bed now .. once python module are all installed (most are part of python core) the rest should run with ease

Now it's telling me "ImportError: No module named 'numpy'", but I already done "apt-get install python-numpy python-scipy"
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on October 02, 2014, 05:56:08 am
python3-numpy
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: kokojie on October 13, 2014, 12:28:07 am
I'm using alt's script with default settings, why do I see other people have 50+ price update per day, and mine is only like 3-4 times  day?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on October 13, 2014, 06:10:49 am
I'm using alt's script with default settings, why do I see other people have 50+ price update per day, and mine is only like 3-4 times  day?
There are different modifications of that script. As far as I know xeroc's version and mine: https://bitsharestalk.org/index.php?topic=9698.0 (https://bitsharestalk.org/index.php?topic=9698.0) .
It also depends on how often you invoke it. How often you get errors from exchanges or clients. Some versions are more sensitive to price changes and even more sensitive when price falls down.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on October 13, 2014, 06:57:32 am
I'm using alt's script with default settings, why do I see other people have 50+ price update per day, and mine is only like 3-4 times  day?
depends on how often you run the script .. and in the config there is a parameter called
Code: [Select]
"common2": "update the feed price at least 23.5 hours a time",
"max_update_hours": 23.5,
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: amencon on October 13, 2014, 07:09:59 am
I'm using alt's script with default settings, why do I see other people have 50+ price update per day, and mine is only like 3-4 times  day?
depends on how often you run the script .. and in the config there is a parameter called
Code: [Select]
"common2": "update the feed price at least 23.5 hours a time",
"max_update_hours": 23.5,
Yep you can also set the min and max change required to trigger an update there as well which will definitely effect how often your feeds update each day.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on October 16, 2014, 01:25:46 am
I'm using alt's script with default settings, why do I see other people have 50+ price update per day, and mine is only like 3-4 times  day?

you need to change the update rule, this is what I use now
Code: [Select]
  "price_limit": {
    "common": "only update price feed when the change rate is between 5% ~ 50%",
    "change_min": 0.5,
    "change_max": 50,
    "common1": "set the frequency, how many seconds need to wait until next fetch",
    "sample_timer": 60,
    "common2": "update the feed price at least 23.5 hours a time",
    "max_update_hours": 23.5,
    "common3": "we use the media price, how many samples need to use",
    "median_length": 61
  },
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on October 16, 2014, 01:30:00 am
delegate please update the script,
fixed a mistake that can't fetch price from btc38.

I think btc123 have the same problem, btsx/cny  stop updated since 20 hours ago, who can tell them?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on October 16, 2014, 02:28:16 am
delegate please update the script,
fixed a mistake that can't fetch price from btc38.

I think btc123 have the same problem, btsx/cny  stop updated since 20 hours ago, who can tell them?

Updated riverhead-del-server-1. Thanks for staying on top of this :).
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on October 16, 2014, 09:50:22 am
delegate please update the script,
fixed a mistake that can't fetch price from btc38.
https://github.com/bitsuperlab/operation_tools/commit/781f62387586278a30d1462dcd8d03641831582b
I don't really understand what you fixed there!?  :-\

could you elaborate?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on October 16, 2014, 10:56:35 am
Code: [Select]
>>> url="http://api.btc38.com/v1/ticker.php"                                                                                                                           
>>> headers = {'content-type': 'application/json',
...    'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0'}
>>> params = { 'c': 'btsx', 'mk_type': 'btc' }
>>> responce = requests.get(url=url, params=params, headers=headers)
>>> vars(responce)['_content']
'\xef\xbb\xbf{"ticker":{"high":6.92e-5,"low":6.37e-5,"last":6.78e-5,"vol":1213613.924615,"buy":6.7e-5,"sell":6.78e-5}}'
>>>
you can see there is special charset '\xef\xbb\xbf', this is because of utf8 encode
so we need to add a call decode("utf-8-sig")
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: kokojie on October 16, 2014, 02:55:08 pm
updated
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on October 17, 2014, 01:53:25 pm
update: add source  from yunbi.com
btc38 return time out many times. maybe because of their firewall.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on November 09, 2014, 12:52:07 am
please update from github for version 0.4.24-rc1

    rename asset name: BTSX->BTS, GLD->GOLD, SLV->SILVER
    remove PTS, PPC, LTC
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: taa on November 10, 2014, 12:53:12 am
updated but having following warning

Code: [Select]

Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later
Warnning: rpc call error, retry 5 seconds later

please update from github for version 0.4.24-rc1

    rename asset name: BTSX->BTS, GLD->GOLD, SLV->SILVER
    remove PTS, PPC, LTC
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on November 10, 2014, 08:07:42 am
there have been some changes into the json format lately .. current price update scripts don't work with the latest git head ...
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: taa on November 10, 2014, 04:22:47 pm
Thanks Bro.  just have no time to view ALT 's autofeed code.  My friend told me he is fighting with this issue since he upgraded to 0.24RC 2 days ago and he did upgrade ALT's autofeed code accordingly......  :'(

there have been some changes into the json format lately .. current price update scripts don't work with the latest git head ...
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on November 11, 2014, 02:59:58 pm
Is this already fixed? I can see delegates with 0.4.24-RC2 and active feeds.

But no matter wich script I tried, from bitsuperlab or xeroc I get
"print "Warnning: rpc call error, retry 5 seconds later"
                                              ^
SyntaxError: invalid syntax"
I'm on 0.4.24-RC2 too.

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'
"

You can still use old script connecting to 0.4.23 client in order to produce feeds.
I'll update my version of the script at the first opportunity. I hope this will be before the hardfork.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on November 11, 2014, 03:04:28 pm
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
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on November 11, 2014, 03:05:08 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!
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on November 11, 2014, 04:06:58 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 (https://bitsharestalk.org/index.php?topic=9698.0)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: 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
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on November 11, 2014, 04:31:22 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.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: 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 ..
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on November 11, 2014, 08:41:27 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.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: 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

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on November 25, 2014, 07:33: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.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on November 25, 2014, 12:08:50 pm
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.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on November 25, 2014, 03:43:55 pm
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.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on November 25, 2014, 06:29:24 pm
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?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on November 25, 2014, 07:08:55 pm
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'

?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: 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?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on November 25, 2014, 10:13:50 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

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on November 25, 2014, 10:14:53 pm
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?
you need update scripts first

来自我的 HUAWEI P7-L00 上的 Tapatalk

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on November 25, 2014, 11:48:14 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?

I dont get response from btc38. I dont think they changed the name. Perhaps they have different issue as they return empy page for the following request: http://api.btc38.com/v1/ticker.php?c=btsx&mk_type=CNY (http://api.btc38.com/v1/ticker.php?c=btsx&mk_type=CNY) and an error for the following http://api.btc38.com/v1/ticker.php?c=bts&mk_type=CNY (http://api.btc38.com/v1/ticker.php?c=bts&mk_type=CNY).
Strangely even http://api.btc38.com/v1/ticker.php?c=all&mk_type=BTC (http://api.btc38.com/v1/ticker.php?c=all&mk_type=BTC) doesn't seem to return sane results (bts is missing).

I'm more concerned about scripts failing if the exchange returns incorrect data.
I'll fix it tomorrow.
For now you can disable btc38.

UPDATE: more info
UPDATE: I've pushed a fix for the script that will ignore malformed response from btc38 (only if exchange importance level is lower than 0.8 )
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Xeldal on November 26, 2014, 12:09:59 am
I had to install the following to get feeds to work

Code: [Select]
apt-get install python3
apt-get install python3-requests
apt-get install python3-numpy

I didn't see this explicitly written anywhere so I thought I'd post it.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on November 26, 2014, 07:32:57 am
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
Just fixed it ...
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on November 26, 2014, 07:35:21 am
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
Just fixed it ...

Yep. Me too. btc38 wasn't working yesterday for me. Now it looks OK.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on November 26, 2014, 07:46:15 am
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
Just fixed it ...

I think your fix might ignore the price feeds from exchanges that haven't changed the name of BTS(X) .
Could you double check if I'm not missing something?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on November 26, 2014, 08:06:11 am
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
Just fixed it ...

Yep. Me too. btc38 wasn't working yesterday for me. Now it looks OK.
thx,  fixed it too
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on November 26, 2014, 08:09:03 am
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
Just fixed it ...

I think your fix might ignore the price feeds from exchanges that haven't changed the name of BTS(X) .
Could you double check if I'm not missing something?

https://github.com/xeroc/pytshares/blob/master/btsx_feed.py#L419

But I will check again ..

edit: checked and decided that emski's solution is nicer :) .. update my script .. also made some variable renames and renamed the script ..
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on November 26, 2014, 09:22:55 am
Anyone know what I need to install to get access to the 'statistics' module?

Code: [Select]
ImportError: No module named 'statistics'
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: svk on November 26, 2014, 09:29:14 am
Anyone know what I need to install to get access to the 'statistics' module?

Code: [Select]
ImportError: No module named 'statistics'

"pip install statistics" I guess?

I didn't need that one though but I'm using emski's version.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on November 26, 2014, 09:35:28 am
the statistics module should be a build-in module of python3!! (THREE!)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on November 26, 2014, 11:17:49 am
the statistics module should be a build-in module of python3!! (THREE!)

That's a bit disturbing, since I'm using python3 to run the command. My system does have an older python on the path, could it be finding some part of the original version, rather than the new one at run time?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on November 26, 2014, 11:12:27 pm
That's a bit disturbing, since I'm using python3 to run the command. My system does have an older python on the path, could it be finding some part of the original version, rather than the new one at run time?

Anyone got any advice? I'm kind of at a loss. I'd appreciate any suggestions because I'd like to provide feeds for my delegate.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on November 26, 2014, 11:45:13 pm
if you are running ubuntu1404, you can try to find the file and check if the package install correct

Code: [Select]
alt@localhost:~/workspace/bitsuperlab/btsfeed$ dpkg -S /usr/lib/python3.4/statistics.py
libpython3.4-stdlib:amd64: /usr/lib/python3.4/statistics.py

That's a bit disturbing, since I'm using python3 to run the command. My system does have an older python on the path, could it be finding some part of the original version, rather than the new one at run time?

Anyone got any advice? I'm kind of at a loss. I'd appreciate any suggestions because I'd like to provide feeds for my delegate.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on November 27, 2014, 08:33:50 am
you could also check with
Code: [Select]
$ python3
import statistics
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on November 27, 2014, 02:24:55 pm
module 'statistics' was new for python 3.4, so this script requires min python 3.4.  I had 3.3.

OP Can you update your requirements list to make this more obvious :)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on November 27, 2014, 02:33:18 pm
module 'statistics' was new for python 3.4, so this script requires min python 3.4.  I had 3.3.

OP Can you update your requirements list to make this more obvious :)
thank you , I'll add to the document :)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on November 27, 2014, 07:19:34 pm
Do I need to configure anything special to get this script to update faster than once per day?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Xeldal on November 27, 2014, 08:04:01 pm
Do I need to configure anything special to get this script to update faster than once per day?

config.json has update frequency set to 23.5 hours by default, you can change to anything you like.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on December 01, 2014, 09:12:40 am
My feeds quantity has suddenly dropped to zero on bitshareblocks.com, but the script is still running - any idea what could have happened?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on December 01, 2014, 09:17:51 am
My feeds quantity has suddenly dropped to zero on bitshareblocks.com, but the script is still running - any idea what could have happened?

Provide script version, commandline arguments and output.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on December 01, 2014, 09:33:51 am
I can't find the version number anywhere, but the last tty output is this:

Code: [Select]
   ASSET  RATE(CNY)    CURRENT_FEED   CURRENT_PRICE    MEDIAN_PRICE    LAST_PUBLISH   CHANGE
-----------------------------------------------------------------------------------------------
    *AUD      5.227               0         0.01982         0.01983         0.01983   -0.01%
    *BTC   2316.707       4.457e-05       4.471e-05       4.473e-05       4.481e-05   -0.18%
    *CAD      5.377               0         0.01926         0.01926         0.01928   -0.07%
    *CHF      6.363               0         0.01628         0.01628         0.01629   -0.03%
    *CNY      1.000          0.1025          0.1036          0.1036          0.1036   -0.01%
    *EUR      7.646         0.01342         0.01355         0.01355         0.01355   -0.03%
    *GBP      9.605               0         0.01078         0.01079         0.01079   -0.05%
   *GOLD   7171.012       1.415e-05       1.444e-05       1.445e-05       1.445e-05   -0.02%
    *HKD      0.792               0          0.1307          0.1308          0.1308   -0.01%
    *JPY      0.052               0               2           2.003               2    0.17%
    *KRW      0.005               0           18.83           18.83           18.84   -0.01%
    *MXN      0.442               0          0.2346          0.2345          0.2344    0.02%
    *NZD      4.820               0         0.02149          0.0215         0.02149    0.04%
    *RUB      0.122               0          0.8476          0.8443           0.843    0.15%
    *SEK      0.824               0          0.1258          0.1257          0.1257    0.01%
    *SGD      4.713               0         0.02198         0.02198         0.02199   -0.03%
 *SILVER     95.169               0        0.001088        0.001089        0.001089   -0.02%
    *TRY      2.768               0         0.03743         0.03744         0.03744    0.00%
    *USD      6.144          0.0167         0.01686         0.01686         0.01686   -0.02%
===============================================================================================

and the last log output is this:

Code: [Select]
2014-11-28 20:17:59,586[INFO]: btc38: price is 0.00000, depth is 0.000, scale is 1.000
2014-11-28 20:17:59,586[INFO]: bter: price is 0.10240, depth is 71027.086, scale is 1.000
2014-11-28 20:17:59,586[INFO]: bts_cny: price is 0.10353, depth is 391458.503, scale is 1.000
2014-11-28 20:17:59,587[INFO]: bts_usd: price is 0.10396, depth is 381613.131, scale is 1.000
2014-11-28 20:17:59,587[INFO]: yunbi: price is 0.10300, depth is 69401.710, scale is 1.000
2014-11-28 20:17:59,587[INFO]: average price is 0.10358
2014-11-28 20:19:04,619[ERROR]: Error fetching results from btc38!
2014-11-28 20:19:04,620[ERROR]: Error get price from btc38!

So it clearly stopped working on the 28th, but like I say the script is still running (I've screened it, so I can see there is no command prompt)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: svk on December 01, 2014, 10:55:34 am
I can't find the version number anywhere, but the last tty output is this:

Code: [Select]
   ASSET  RATE(CNY)    CURRENT_FEED   CURRENT_PRICE    MEDIAN_PRICE    LAST_PUBLISH   CHANGE
-----------------------------------------------------------------------------------------------
    *AUD      5.227               0         0.01982         0.01983         0.01983   -0.01%
    *BTC   2316.707       4.457e-05       4.471e-05       4.473e-05       4.481e-05   -0.18%
    *CAD      5.377               0         0.01926         0.01926         0.01928   -0.07%
    *CHF      6.363               0         0.01628         0.01628         0.01629   -0.03%
    *CNY      1.000          0.1025          0.1036          0.1036          0.1036   -0.01%
    *EUR      7.646         0.01342         0.01355         0.01355         0.01355   -0.03%
    *GBP      9.605               0         0.01078         0.01079         0.01079   -0.05%
   *GOLD   7171.012       1.415e-05       1.444e-05       1.445e-05       1.445e-05   -0.02%
    *HKD      0.792               0          0.1307          0.1308          0.1308   -0.01%
    *JPY      0.052               0               2           2.003               2    0.17%
    *KRW      0.005               0           18.83           18.83           18.84   -0.01%
    *MXN      0.442               0          0.2346          0.2345          0.2344    0.02%
    *NZD      4.820               0         0.02149          0.0215         0.02149    0.04%
    *RUB      0.122               0          0.8476          0.8443           0.843    0.15%
    *SEK      0.824               0          0.1258          0.1257          0.1257    0.01%
    *SGD      4.713               0         0.02198         0.02198         0.02199   -0.03%
 *SILVER     95.169               0        0.001088        0.001089        0.001089   -0.02%
    *TRY      2.768               0         0.03743         0.03744         0.03744    0.00%
    *USD      6.144          0.0167         0.01686         0.01686         0.01686   -0.02%
===============================================================================================

and the last log output is this:

Code: [Select]
2014-11-28 20:17:59,586[INFO]: btc38: price is 0.00000, depth is 0.000, scale is 1.000
2014-11-28 20:17:59,586[INFO]: bter: price is 0.10240, depth is 71027.086, scale is 1.000
2014-11-28 20:17:59,586[INFO]: bts_cny: price is 0.10353, depth is 391458.503, scale is 1.000
2014-11-28 20:17:59,587[INFO]: bts_usd: price is 0.10396, depth is 381613.131, scale is 1.000
2014-11-28 20:17:59,587[INFO]: yunbi: price is 0.10300, depth is 69401.710, scale is 1.000
2014-11-28 20:17:59,587[INFO]: average price is 0.10358
2014-11-28 20:19:04,619[ERROR]: Error fetching results from btc38!
2014-11-28 20:19:04,620[ERROR]: Error get price from btc38!

So it clearly stopped working on the 28th, but like I say the script is still running (I've screened it, so I can see there is no command prompt)

btc38 changed their API from BTSX to BTS, is your script updated for that?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on December 01, 2014, 12:07:56 pm
btc38 changed their API from BTSX to BTS, is your script updated for that?

Evidently not. But there are loads of instances of that particular error in the log, so not sure why it just stopped working now.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: emski on December 01, 2014, 12:12:05 pm
btc38 changed their API from BTSX to BTS, is your script updated for that?

Evidently not. But there are loads of instances of that particular error in the log, so not sure why it just stopped working now.

That error shouldn't prevent the script from finishing. I've seen similar behavior but I'm not yet sure why it happens. I'll investigate further.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on December 01, 2014, 12:12:43 pm
Mine froze too. I just restarted them and they are fine again.

Sent from my Timex Sinclair.

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on December 01, 2014, 01:49:51 pm
That error shouldn't prevent the script from finishing. I've seen similar behavior but I'm not yet sure why it happens. I'll investigate further.

When I ctrl-d'ed the process it said it was stuck in a sleep() call, if that's any help?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 01, 2014, 02:44:22 pm
I have fixed some bug maybe cause this problem
please update to the latest
I can't find the version number anywhere, but the last tty output is this:

Code: [Select]
   ASSET  RATE(CNY)    CURRENT_FEED   CURRENT_PRICE    MEDIAN_PRICE    LAST_PUBLISH   CHANGE
-----------------------------------------------------------------------------------------------
    *AUD      5.227               0         0.01982         0.01983         0.01983   -0.01%
    *BTC   2316.707       4.457e-05       4.471e-05       4.473e-05       4.481e-05   -0.18%
    *CAD      5.377               0         0.01926         0.01926         0.01928   -0.07%
    *CHF      6.363               0         0.01628         0.01628         0.01629   -0.03%
    *CNY      1.000          0.1025          0.1036          0.1036          0.1036   -0.01%
    *EUR      7.646         0.01342         0.01355         0.01355         0.01355   -0.03%
    *GBP      9.605               0         0.01078         0.01079         0.01079   -0.05%
   *GOLD   7171.012       1.415e-05       1.444e-05       1.445e-05       1.445e-05   -0.02%
    *HKD      0.792               0          0.1307          0.1308          0.1308   -0.01%
    *JPY      0.052               0               2           2.003               2    0.17%
    *KRW      0.005               0           18.83           18.83           18.84   -0.01%
    *MXN      0.442               0          0.2346          0.2345          0.2344    0.02%
    *NZD      4.820               0         0.02149          0.0215         0.02149    0.04%
    *RUB      0.122               0          0.8476          0.8443           0.843    0.15%
    *SEK      0.824               0          0.1258          0.1257          0.1257    0.01%
    *SGD      4.713               0         0.02198         0.02198         0.02199   -0.03%
 *SILVER     95.169               0        0.001088        0.001089        0.001089   -0.02%
    *TRY      2.768               0         0.03743         0.03744         0.03744    0.00%
    *USD      6.144          0.0167         0.01686         0.01686         0.01686   -0.02%
===============================================================================================

and the last log output is this:

Code: [Select]
2014-11-28 20:17:59,586[INFO]: btc38: price is 0.00000, depth is 0.000, scale is 1.000
2014-11-28 20:17:59,586[INFO]: bter: price is 0.10240, depth is 71027.086, scale is 1.000
2014-11-28 20:17:59,586[INFO]: bts_cny: price is 0.10353, depth is 391458.503, scale is 1.000
2014-11-28 20:17:59,587[INFO]: bts_usd: price is 0.10396, depth is 381613.131, scale is 1.000
2014-11-28 20:17:59,587[INFO]: yunbi: price is 0.10300, depth is 69401.710, scale is 1.000
2014-11-28 20:17:59,587[INFO]: average price is 0.10358
2014-11-28 20:19:04,619[ERROR]: Error fetching results from btc38!
2014-11-28 20:19:04,620[ERROR]: Error get price from btc38!

So it clearly stopped working on the 28th, but like I say the script is still running (I've screened it, so I can see there is no command prompt)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on December 01, 2014, 03:12:13 pm
I have fixed some bug maybe cause this problem
please update to the latest

The freezing problem, or the btc38 problem?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 01, 2014, 03:58:44 pm
both
I have fixed some bug maybe cause this problem
please update to the latest

The freezing problem, or the btc38 problem?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: bitcoinerS on December 01, 2014, 06:29:38 pm
After latest git pull
bts_feed_auto.py stopped working.
It now just waits infinitely..
Code: [Select]
$ ./bts_feed_auto.py USD

I have installed
Code: [Select]
python3
python3-requests
python3-numpy

on Ubuntu. Also copied and updated new config.json

Code: [Select]
{
  "asset_list_display": ["CNY", "USD", "BTC", "GOLD"],
  "delegate_list": ["bitcoiners"],
  "client": {
    "rpc_host": "localhost",
    "rpc_port": "9989",
    "rpc_user": "bitcoinerS",
    "rpc_password": "*"
  },
  "price_limit": {
    "common": "only update price feed when the change rate is between 5% ~ 100%",
    "change_min": 0.5,
    "change_max": 50,
    "common1": "set the frequency, how many seconds need to wait until next fetch",
    "sample_timer": 60,
    "common2": "update the feed price at least 23.5 hours a time",
    "max_update_hours": 2.5,
    "common3": "we use the median price, how many samples need to use",
    "median_length": 31
  },
  "market_weight": {
    "common": "weight depenth on (depth * scale)",
    "common1": "include depth between price*(1-depth_change) and price*(1+depth_change)",
    "depth_change": 0.03,
    "scale_bts_usd": 1,
    "scale_bts_cny": 1,
    "scale_btc38": 1,
    "scale_yunbi": 1,
    "scale_bter": 1
  },
  "log" : {
    "filename" : "log-bts.txt",
    "logMaxByte" : 1024000,
    "logBackupCnt" : 15
  }
}
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 01, 2014, 11:48:26 pm
watch the log file for error message
log-bts.txt
After latest git pull
bts_feed_auto.py stopped working.
It now just waits infinitely..
Code: [Select]
$ ./bts_feed_auto.py USD

I have installed
Code: [Select]
python3
python3-requests
python3-numpy

on Ubuntu. Also copied and updated new config.json

Code: [Select]
{
  "asset_list_display": ["CNY", "USD", "BTC", "GOLD"],
  "delegate_list": ["bitcoiners"],
  "client": {
    "rpc_host": "localhost",
    "rpc_port": "9989",
    "rpc_user": "bitcoinerS",
    "rpc_password": "*"
  },
  "price_limit": {
    "common": "only update price feed when the change rate is between 5% ~ 100%",
    "change_min": 0.5,
    "change_max": 50,
    "common1": "set the frequency, how many seconds need to wait until next fetch",
    "sample_timer": 60,
    "common2": "update the feed price at least 23.5 hours a time",
    "max_update_hours": 2.5,
    "common3": "we use the median price, how many samples need to use",
    "median_length": 31
  },
  "market_weight": {
    "common": "weight depenth on (depth * scale)",
    "common1": "include depth between price*(1-depth_change) and price*(1+depth_change)",
    "depth_change": 0.03,
    "scale_bts_usd": 1,
    "scale_bts_cny": 1,
    "scale_btc38": 1,
    "scale_yunbi": 1,
    "scale_bter": 1
  },
  "log" : {
    "filename" : "log-bts.txt",
    "logMaxByte" : 1024000,
    "logBackupCnt" : 15
  }
}
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: bitcoinerS on December 02, 2014, 01:20:47 am
watch the log file for error message
log-bts.txt
After latest git pull
bts_feed_auto.py stopped working.
It now just waits infinitely..
Code: [Select]
$ ./bts_feed_auto.py USD

I have installed
Code: [Select]
python3
python3-requests
python3-numpy

on Ubuntu. Also copied and updated new config.json

Code: [Select]
{
  "asset_list_display": ["CNY", "USD", "BTC", "GOLD"],
  "delegate_list": ["bitcoiners"],
  "client": {
    "rpc_host": "localhost",
    "rpc_port": "9989",
    "rpc_user": "bitcoinerS",
    "rpc_password": "*"
  },
  "price_limit": {
    "common": "only update price feed when the change rate is between 5% ~ 100%",
    "change_min": 0.5,
    "change_max": 50,
    "common1": "set the frequency, how many seconds need to wait until next fetch",
    "sample_timer": 60,
    "common2": "update the feed price at least 23.5 hours a time",
    "max_update_hours": 2.5,
    "common3": "we use the median price, how many samples need to use",
    "median_length": 31
  },
  "market_weight": {
    "common": "weight depenth on (depth * scale)",
    "common1": "include depth between price*(1-depth_change) and price*(1+depth_change)",
    "depth_change": 0.03,
    "scale_bts_usd": 1,
    "scale_bts_cny": 1,
    "scale_btc38": 1,
    "scale_yunbi": 1,
    "scale_bter": 1
  },
  "log" : {
    "filename" : "log-bts.txt",
    "logMaxByte" : 1024000,
    "logBackupCnt" : 15
  }
}

Code: [Select]
$ cat log-bts.txt
2014-11-30 22:56:28,284[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 22:57:49,674[ERROR]: Error fetching results from bter!
2014-11-30 22:57:49,675[ERROR]: Error get price from bter!
2014-11-30 22:57:51,969[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 22:59:16,253[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 23:00:24,598[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 23:01:29,085[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 23:02:38,847[ERROR]: Error fetching results from yunbi!
2014-11-30 23:02:38,847[ERROR]: Error get price from yunbi!
2014-11-30 23:02:38,905[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 23:03:47,831[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 23:04:55,646[ERROR]: Warning: unknown error, can't fetch price
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 02, 2014, 01:30:57 am
I have no idea about these logs...
try to remove the try{} except {} , and see what's wrong
Code: [Select]
while True:
  try:
    fetch_price()
    display_price()
  except:
    logger.error("Warning: unknown error, can't fetch price")
  time.sleep(sample_timer)
to
Code: [Select]
while True:
    fetch_price()
    display_price()
    time.sleep(sample_timer)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 02, 2014, 01:34:08 am
Sorry to @xeroc, I forgot an very important thing.


I have used part of your code from here:
https://github.com/xeroc/btsx_bots

I don't know how should I do with  the MIT Licence?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on December 02, 2014, 07:04:24 am
Sorry to @xeroc, I forgot an very important thing.
Hug? .. why sorry? What did you forget?

Quote
I have used part of your code from here:
https://github.com/xeroc/btsx_bots
IIRC I used parts of YOUR script to begin with :)

Quote
I don't know how should I do with  the MIT Licence?
AFAIK the MIT allows to use the code for what ever you like ..
so please go ahead and use the code for what every you like :)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 02, 2014, 07:19:55 am
Sorry to @xeroc, I forgot an very important thing.
Hug? .. why sorry? What did you forget?

Quote
I have used part of your code from here:
https://github.com/xeroc/btsx_bots
IIRC I used parts of YOUR script to begin with :)

Quote
I don't know how should I do with  the MIT Licence?
AFAIK the MIT allows to use the code for what ever you like ..
so please go ahead and use the code for what every you like :)
seriously, I am not family with this thing,
If somebody use your source code, what does he need to do to observe  MIT Licence?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: wackou on December 02, 2014, 10:44:34 am
try to remove the try{} except {} , and see what's wrong
Code: [Select]
while True:
  try:
    fetch_price()
    display_price()
  except:
    logger.error("Warning: unknown error, can't fetch price")
  time.sleep(sample_timer)

Small tip: if you want to see what exception was raised, but still want to catch it, you can do it like so:
Code: [Select]
while True:
  try:
    fetch_price()
    display_price()
  except Exception as e:
    logger.error("Warning: unknown error, can't fetch price")
    logger.exception(e)
  time.sleep(sample_timer)
which will print the exception type, message and stack trace.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 02, 2014, 11:37:24 am
try to remove the try{} except {} , and see what's wrong
Code: [Select]
while True:
  try:
    fetch_price()
    display_price()
  except:
    logger.error("Warning: unknown error, can't fetch price")
  time.sleep(sample_timer)

Small tip: if you want to see what exception was raised, but still want to catch it, you can do it like so:
Code: [Select]
while True:
  try:
    fetch_price()
    display_price()
  except Exception as e:
    logger.error("Warning: unknown error, can't fetch price")
    logger.exception(e)
  time.sleep(sample_timer)
which will print the exception type, message and stack trace.
I don't know that, thank you very much.  :P
I'll add this
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on December 02, 2014, 11:47:39 am
Sorry to @xeroc, I forgot an very important thing.
Hug? .. why sorry? What did you forget?

Quote
I have used part of your code from here:
https://github.com/xeroc/btsx_bots
IIRC I used parts of YOUR script to begin with :)

Quote
I don't know how should I do with  the MIT Licence?
AFAIK the MIT allows to use the code for what ever you like ..
so please go ahead and use the code for what every you like :)
seriously, I am not family with this thing,
If somebody use your source code, what does he need to do to observe  MIT Licence?
I am not a lawyer .. but I hereby allow you to do whatever you like with that code ..
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: bitcoinerS on December 02, 2014, 03:41:00 pm

Code: [Select]
$ tail  -f log-bts.txt
2014-12-02 07:38:04,754[ERROR]: Warning: unknown error, can't fetch price
2014-12-02 07:38:04,754[ERROR]: 'short_price_limit'
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 66, in get_depth_in_range
    price_limit = order["state"]["short_price_limit"]
KeyError: 'short_price_limit'


Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 02, 2014, 11:46:39 pm

Code: [Select]
$ tail  -f log-bts.txt
2014-12-02 07:38:04,754[ERROR]: Warning: unknown error, can't fetch price
2014-12-02 07:38:04,754[ERROR]: 'short_price_limit'
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 66, in get_depth_in_range
    price_limit = order["state"]["short_price_limit"]
KeyError: 'short_price_limit'


what's your client version?
and can you add pprint(order_short) at line 66 of bts.py to see what's the return data.

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: bitcoinerS on December 03, 2014, 03:26:22 am
Code: [Select]
Warning: unknown error, can't fetch price
2014-12-02 19:23:54,204[ERROR]: 'result'
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 43, in get_depth_in_range
    price = self.get_price(quote,base)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 233, in get_price
    order = response.json()["result"]
KeyError: 'result'


latest git pull
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on December 03, 2014, 03:28:49 am
alt: There is an increasing desire for a price feed for oil. Since most delegates run your feed if you find a way to get that working the market will open up.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 03, 2014, 04:03:33 am
alt: There is an increasing desire for a price feed for oil. Since most delegates run your feed if you find a way to get that working the market will open up.
do you know where to get the oil price?
I have no idea about hits...
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 03, 2014, 04:04:21 am
Code: [Select]
Warning: unknown error, can't fetch price
2014-12-02 19:23:54,204[ERROR]: 'result'
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 43, in get_depth_in_range
    price = self.get_price(quote,base)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 233, in get_price
    order = response.json()["result"]
KeyError: 'result'


latest git pull
looks like your config file about client is not correct, the rpc call can't work
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Riverhead on December 03, 2014, 04:06:58 am
alt: There is an increasing desire for a price feed for oil. Since most delegates run your feed if you find a way to get that working the market will open up.
do you know where to get the oil price?
I have no idea about hits...

Currently skyscrapperfarms is the only one pushing a feed. I'll ping him and see if he'll share.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: chsln on December 03, 2014, 11:17:53 am
Hi, I have an idea on how to get oil price.

Oil price is taken from futures, and it will change symbol every 15Th day of the month.

for example the symbol for January 2015 on yahoo is CLF15.NYM

for February is CLG15.NYM

the symbol it buit as this CL + letter indicating the month + year + .NYM

the months are:

F: JAN
G: FEB
H: MAR
J: APR
K: MAY
M: JUN
N: JUL
Q: AUG
U: SEP
V: OCT
X: NOV
Z: DEC

to get a consistent oil price we should feed the averange price for the last two futures.
For example the actual price should be calculated as:
(CLF15.NYM + CLG15.NYM) / 2

then the 15Th of December it should change to (CLG15.NYM + CLH15.NYM) / 2

Edit: the averange between the two prices should be weighted based on the day it is calculated
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on December 03, 2014, 12:05:10 pm
Why wouldn't you just take CLY0, which is the cash price?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on December 03, 2014, 12:35:23 pm
Why wouldn't you just take CLY0, which is the cash price?
you know of a page that exposes CLY0 through an api?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on December 03, 2014, 04:27:58 pm
Why wouldn't you just take CLY0, which is the cash price?
you know of a page that exposes CLY0 through an api?

Not CLY0, no. I did find this, though:

http://www.nasdaq.com/markets/commodities.aspx

NYMEX WTI Crude Oil, and this page has a real time price. It's dirty work, but you could write a script to parse the HTML and pull out the number - they don't have an API, the data is baked into the source.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: chsln on December 03, 2014, 05:44:18 pm
Why wouldn't you just take CLY0, which is the cash price?
you know of a page that exposes CLY0 through an api?

Not CLY0, no. I did find this, though:

http://www.nasdaq.com/markets/commodities.aspx

NYMEX WTI Crude Oil, and this page has a real time price. It's dirty work, but you could write a script to parse the HTML and pull out the number - they don't have an API, the data is baked into the source.

That is the same price as CLF15.NYM so it refers to the last future.

CLY0 is shown on barchart but with 0 volume http://www.barchart.com/quotes/futures/CLY0 (http://www.barchart.com/quotes/futures/CLY0) so i guess it's calculated somehow.

Just a note: most of the prices you get from yahoo or anywhere else for free are delayed at least 10 minutes. It's not real time data. If it is that important to have real time data we'll have to pay to get it.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: monsterer on December 03, 2014, 09:31:16 pm
Just a note: most of the prices you get from yahoo or anywhere else for free are delayed at least 10 minutes. It's not real time data. If it is that important to have real time data we'll have to pay to get it.

How much does this typically cost?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: iHashFury on December 06, 2014, 04:28:36 pm
Hello

I have set-up price feeds on my delegate using the following code to run in a tmux terminal:

Code: [Select]
git clone https://github.com/bitsuperlab/operation_tools.git
sudo apt-get install python3-requests python3-numpy
#edit config.json
tmux
cd ~/operation_tools/btsfeed && ./bts_feed_auto.py ALL

and get the following output.

Code: [Select]
===================20141206T172117=======================
    EXCHANGE           PRICE           DEPTH    SCALE
---------------------------------------------------------
       btc38         0.10550    247440.43475  1.00000
        bter         0.10380     26197.36493  1.00000
     bts_cny         0.10744    204827.47117  1.00000
     bts_usd         0.11093       165.00000  1.00000
       yunbi         0.10450     48393.14000  1.00000
---------------------------------------------------------
     average         0.10608
========================================================
===============================================================================================
   ASSET  RATE(CNY)    CURRENT_FEED   CURRENT_PRICE    MEDIAN_PRICE    LAST_PUBLISH   CHANGE
-----------------------------------------------------------------------------------------------
    *AUD      5.118               0         0.02073         0.02072         0.02074   -0.07%
    *BTC   2304.853       4.559e-05       4.602e-05       4.601e-05       4.613e-05   -0.27%
    *CAD      5.378               0         0.01973         0.01972         0.01973   -0.07%
    *CHF      6.284               0         0.01688         0.01687         0.01689   -0.07%
    *CNY      1.000          0.1054          0.1061           0.106          0.1061   -0.07%
    *EUR      7.556         0.01394         0.01404         0.01403         0.01404   -0.07%
    *GBP      9.582               0         0.01107         0.01107         0.01108   -0.07%
   *GOLD   7335.958       1.436e-05       1.446e-05       1.446e-05       1.447e-05   -0.07%
    *HKD      0.793               0          0.1337          0.1336          0.1337   -0.07%
    *JPY      0.051               0           2.096           2.096           2.097   -0.07%
    *KRW      0.005               0           19.29           19.28           19.29   -0.07%
    *MXN      0.428               0          0.2476          0.2475          0.2477   -0.07%
    *NZD      4.742               0         0.02237         0.02236         0.02238   -0.07%
    *RUB      0.117               0          0.9082          0.9079          0.9086   -0.07%
    *SEK      0.814               0          0.1303          0.1303          0.1304   -0.07%
    *SGD      4.650               0         0.02281         0.02281         0.02282   -0.07%
 *SILVER     99.609               0        0.001065        0.001065        0.001065   -0.07%
    *TRY      2.721               0         0.03899         0.03898         0.03901   -0.07%
    *USD      6.150         0.01712         0.01725         0.01724         0.01725   -0.07%
===============================================================================================

How does the market_weight scale work and what scale should I use?
Is that my delegate ready to publish price feeds?

Thanks
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: Xeldal on December 06, 2014, 04:54:19 pm
Still getting errors..

Code: [Select]
git clone https://github.com/Bitsuperlab/operation_tools.git
cd operation_tools/btsfeed
cp config-sample.json config.json
./bts_feed_auto.py ALL


Code: [Select]
cat log-bts.txt
2014-12-05 10:33:49,277[ERROR]: Warning: unknown error, can't fetch price
2014-12-05 10:33:49,278[ERROR]: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/bitcoiners/local/operation_tools/btsfeed/bts.py", line 43, in get_depth_in_range
    price = self.get_price(quote,base)
  File "/home/bitcoiners/local/operation_tools/btsfeed/bts.py", line 233, in get_price
    order = response.json()["result"]
  File "/usr/lib/python3/dist-packages/requests/models.py", line 756, in json
    return json.loads(self.content.decode(encoding), **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 501, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 393, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)


Not sure if this is causing your errors but I noticed anywhere that I use a value less than 1 ( like 0.75)  the decimal must be preceded by a zero or I get errors and feeds script will not run. 

.75 does not work
0.75 works fine

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: clayop on December 09, 2014, 03:53:26 am
Code: [Select]
Warning: unknown error, can't fetch price
2014-12-02 19:23:54,204[ERROR]: 'result'
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 43, in get_depth_in_range
    price = self.get_price(quote,base)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 233, in get_price
    order = response.json()["result"]
KeyError: 'result'


latest git pull
looks like your config file about client is not correct, the rpc call can't work

I have the same error. My delegate is not 101. I checked config.json many times but found no errors yet.

ADD: 0.4.25-RC1
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 09, 2014, 03:15:05 pm
update for version 0.4.25

But I have no idea about this problem, the rpc call is failed.
Code: [Select]
Warning: unknown error, can't fetch price
2014-12-02 19:23:54,204[ERROR]: 'result'
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 43, in get_depth_in_range
    price = self.get_price(quote,base)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 233, in get_price
    order = response.json()["result"]
KeyError: 'result'
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: clayop on December 09, 2014, 04:21:25 pm
update for version 0.4.25

I still have some errors, maybe because I am not 101 delegate. But 0.4.25 support non-delegate to publish feeds.

Code: [Select]
2014-12-09 11:10:52,051[INFO]: btc38: price is 0.09400, depth is 422369.960, scale is 0.900
2014-12-09 11:10:52,052[INFO]: bter: price is 0.09590, depth is 944.661, scale is 1.000
2014-12-09 11:10:52,052[INFO]: bts_cny: price is 0.09542, depth is 155000.000, scale is 1.000
2014-12-09 11:10:52,053[INFO]: bts_usd: price is 0.11139, depth is 0.667, scale is 1.000
2014-12-09 11:10:52,053[INFO]: yunbi: price is 0.09490, depth is 27959.390, scale is 1.100
2014-12-09 11:10:52,053[INFO]: average price is 0.09444
2014-12-09 11:10:52,250[ERROR]: delegate-clayop publish feeds error
2014-12-09 11:10:52,250[ERROR]: {'error': {'message': 'Assert Exception (10)\nmy->is_unique_account(account_name): \n\n\n\n', 'detail': '10 assert_exception: Assert Exception\nmy->is_unique_a$

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: chsln on December 09, 2014, 04:51:52 pm
Works for my delegate even if it's not in the top 101
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: clayop on December 09, 2014, 06:44:19 pm
Works for my delegate even if it's not in the top 101

Do you have clear log?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: clayop on December 09, 2014, 08:15:19 pm
Oh I found the problem. I had local account with the same name of my delegate. Sorry about confusion, alt. Your script is working perfectly now.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: liondani on December 09, 2014, 09:56:50 pm
Works for my delegate even if it's not in the top 101

https://github.com/BitShares/bitshares/releases/tag/v0.4.25-RC1

-Inactive delegates can now publish price feeds
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: lafona on December 10, 2014, 01:50:20 pm
Works for my delegate even if it's not in the top 101

https://github.com/BitShares/bitshares/releases/tag/v0.4.25-RC1

-Inactive delegates can now publish price feeds

Is there are way to check if we are publishing feeds if we are not in 101. The script seems to be working fine, but nothing shows up in bitsharesblocks.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: xeroc on December 10, 2014, 03:17:51 pm
Is there are way to check if we are publishing feeds if we are not in 101. The script seems to be working fine, but nothing shows up in bitsharesblocks.

blockchain_get_feeds_from_delegate <delegatename>
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: lafona on December 10, 2014, 04:18:20 pm
Is there are way to check if we are publishing feeds if we are not in 101. The script seems to be working fine, but nothing shows up in bitsharesblocks.

blockchain_get_feeds_from_delegate <delegatename>

Thanks!
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: coolspeed on December 22, 2014, 12:37:43 pm
According to http://www.bitsharesblocks.com/delegates
I found my delegates have very little amount of active feeds. (But my total feeds are much enough).
Does anyone know why? Thanks.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on December 22, 2014, 02:49:55 pm
According to http://www.bitsharesblocks.com/delegates
I found my delegates have very little amount of active feeds. (But my total feeds are much enough).
Does anyone know why? Thanks.
you just publish price  for USD,CNY,BTS,GOLD,  you can run the command with parameter "ALL"  to publish for all support asset.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: coolspeed on December 22, 2014, 04:19:37 pm

According to http://www.bitsharesblocks.com/delegates
I found my delegates have very little amount of active feeds. (But my total feeds are much enough).
Does anyone know why? Thanks.
you just publish price  for USD,CNY,BTS,GOLD,  you can run the command with parameter "ALL"  to publish for all support asset.

Thank you, alt ;)
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: nethyb on January 18, 2015, 04:24:02 am
I'm getting the following errors on one of my delegates (other is OK strangely) since I've updated the bts client to "v0.5.0" and so I'm unable to publish feeds...

Code: [Select]
Warning: unknown error, can't fetch price
'result'

some of the log results are:

Code: [Select]
2015-01-18 03:45:54,138[ERROR]: Error fetching results from btc38!
2015-01-18 03:45:54,138[ERROR]: Error get price from btc38!
2015-01-18 03:45:57,462[ERROR]: Warning: unknown error, can't fetch price
2015-01-18 03:45:57,462[ERROR]: 'result'
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 44, in get_depth_in_range
    price = self.get_price(quote,base)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 234, in get_price
    order = response.json()["result"]
KeyError: 'result'
2015-01-18 04:07:20,687[ERROR]: Warning: unknown error, can't fetch price
2015-01-18 04:07:20,687[ERROR]: 'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 48, in get_depth_in_range
    base_precision =  self.get_precision(base)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 295, in get_precision
    return float(response.json()["result"]["precision"])
TypeError: 'NoneType' object is not subscriptable
2015-01-18 04:08:31,155[ERROR]: Error fetching results from yunbi!
2015-01-18 04:08:31,157[ERROR]: Error get price from yunbi!
2015-01-18 04:08:31,165[ERROR]: Warning: unknown error, can't fetch price
2015-01-18 04:08:31,165[ERROR]: 'result'
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 44, in get_depth_in_range
    price = self.get_price(quote,base)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 234, in get_price
    order = response.json()["result"]
KeyError: 'result'

Any ideas? I've completely re-cloned the operations_tools from github and copied my config.json from the working delegate and getting the same results...
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on January 20, 2015, 02:06:47 am
I'm getting the following errors on one of my delegates (other is OK strangely) since I've updated the bts client to "v0.5.0" and so I'm unable to publish feeds...

Code: [Select]
Warning: unknown error, can't fetch price
'result'

some of the log results are:

Code: [Select]
2015-01-18 03:45:54,138[ERROR]: Error fetching results from btc38!
2015-01-18 03:45:54,138[ERROR]: Error get price from btc38!
2015-01-18 03:45:57,462[ERROR]: Warning: unknown error, can't fetch price
2015-01-18 03:45:57,462[ERROR]: 'result'
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 44, in get_depth_in_range
    price = self.get_price(quote,base)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 234, in get_price
    order = response.json()["result"]
KeyError: 'result'
2015-01-18 04:07:20,687[ERROR]: Warning: unknown error, can't fetch price
2015-01-18 04:07:20,687[ERROR]: 'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 48, in get_depth_in_range
    base_precision =  self.get_precision(base)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 295, in get_precision
    return float(response.json()["result"]["precision"])
TypeError: 'NoneType' object is not subscriptable
2015-01-18 04:08:31,155[ERROR]: Error fetching results from yunbi!
2015-01-18 04:08:31,157[ERROR]: Error get price from yunbi!
2015-01-18 04:08:31,165[ERROR]: Warning: unknown error, can't fetch price
2015-01-18 04:08:31,165[ERROR]: 'result'
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 44, in get_depth_in_range
    price = self.get_price(quote,base)
  File "/home/ubuntu/operation_tools/btsfeed/bts.py", line 234, in get_price
    order = response.json()["result"]
KeyError: 'result'

Any ideas? I've completely re-cloned the operations_tools from github and copied my config.json from the working delegate and getting the same results...

seems rpc call service not available,
can you check if the ip,port,user,password of rpc service is correct?
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: nethyb on January 21, 2015, 07:17:55 am
...
Quote
seems rpc call service not available,
can you check if the ip,port,user,password of rpc service is correct?

 +5% Thanks alt...

You got me looking in the right area - turned out I hadn't changed the RPC listening port for the devshares delegate running on the same server! So it was conflicting, probably polling my devshares RPC interface!

Problem resolved.
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: clayop on April 21, 2015, 09:47:33 pm
The feed price script may need to be updated.

https://bitsharestalk.org/index.php/topic,15851.msg203639.html#msg203639
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on April 21, 2015, 10:20:08 pm
The feed price script may need to be updated.

https://bitsharestalk.org/index.php/topic,15851.msg203639.html#msg203639
thanks, I'll check it

来自我的 HUAWEI P7-L00 上的 Tapatalk

Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on April 24, 2015, 02:59:57 am
I have update for bitshares  v0.9
should support both v0.9 and v0.8 now
Title: Re: publish feed price automatic(From BitSuperLab)
Post by: alt on June 04, 2015, 12:39:17 pm
please use the new script:
https://bitsharestalk.org/index.php/topic,16170.msg213621.html#msg213621