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.
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).
Quote from: alt on August 28, 2014, 02:18:26 AM
2. if you just want to watch the price, run command without parameter, update every 1 minute
./btsx_feed_auto.py
~/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:
134 if confirm():
135 for asset in asset_list_publish:
136 if len(price[asset]) > 0:
137 update_feed(price_average[asset], asset)
Quote from: xeroc on August 28, 2014, 07:50:06 AM
Quote from: alt on August 28, 2014, 02:18:26 AM
2. if you just want to watch the price, run command without parameter, update every 1 minute
./btsx_feed_auto.py
~/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:
134 if confirm():
135 for asset in asset_list_publish:
136 if len(price[asset]) > 0:
137 update_feed(price_average[asset], asset)
thx
When it comes time for this to publish my feed I get
Warnning: Can't connect to rpc server, retry 5 seconds later
my btsxfeed config JSON looks like this
{
"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
{
"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?
Yhea. .. switch the port over to
"httpd_endpoint": "127.0.0.1:9988",
and leave the RPC with something welse
Quote from: 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
Still the same error, but at least now it isn't locking up my delegate and killing it.
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
./bitshares_client --server --httpport 9989 --rpcuser user --rpcpassword pass
Quote from: puppies on August 28, 2014, 08:06:56 PM
When it comes time for this to publish my feed I get
Warnning: Can't connect to rpc server, retry 5 seconds later
my btsxfeed config JSON looks like this
{
"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
{
"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?
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 :).
Quote from: 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
./bitshares_client --server --httpport 9989 --rpcuser user --rpcpassword pass
Quote from: puppies on August 28, 2014, 08:06:56 PM
When it comes time for this to publish my feed I get
Warnning: Can't connect to rpc server, retry 5 seconds later
my btsxfeed config JSON looks like this
{
"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
{
"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?
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.....
{
"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
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
Quote from: puppies on August 28, 2014, 08:06:56 PM
When it comes time for this to publish my feed I get
Warnning: Can't connect to rpc server, retry 5 seconds later
my btsxfeed config JSON looks like this
{
"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
{
"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?
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.
sorry for the confuse, I have update the file readme.md
Quote from: heyD 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).
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.
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:
{
"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:
{
"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:
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
./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
try to print the responce after call requests.post.
Quote from: 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:
{
"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:
{
"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:
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
./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
update to github.
update the feed price at least every 23.5 hours. because the feed price will expired after 24 hours.
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%
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.
Great job. +5%
I'm using this tool and it looks like very steady.
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 :)
Quote from: 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 :)
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.
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.
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
Quote from: alt on September 15, 2014, 04:37:29 AM
I don't know how to get WTI and SLV from yahoo.
thanks, this looks so complex, I still have no idea about this...
Quote from: 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
Quote from: alt on September 15, 2014, 04:37:29 AM
I don't know how to get WTI and SLV from yahoo.
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!!
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)
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 :).
Quote from: 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 :).
there is a little button next to the bitUSD/BTSX on the top ... that makes the market swap/flipshould read more before posting .. sry
Quote from: xeroc on September 15, 2014, 11:48:37 AM
Quote from: 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 :) .
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?
I have try to use this command, but it's failed, do you know how to use this?
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
Quote from: 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!!
From another thread. If you havn't already seen it.
Quote from: Fox on September 16, 2014, 12:10:34 AM
@xeroc:
It took me some trial and error before I could work out the proper syntax. Here is my latest update:
wallet_publish_feeds fox [["USD",0.0341],["CNY",0.2040]]
thanks, I have update the script to use wallet_publish_feeds
Quote from: alt on September 16, 2014, 01:41:38 AM
thanks, I have update the script to use wallet_publish_feeds
Awesome!
I'm using it, it works!
could it accept the command line arg "ALL""
./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.
Quote from: maqifrnswa on September 16, 2014, 02:05:59 AM
could it accept the command line arg "ALL""
./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%
ok, support param ALL now, not support these 4 assets for now: PTS, PPC, LTC, WTI
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]]
alt you are a rock star.
wow +5%
Great stuff alt, I can confirm it works with ALL :)
This should greatly increase the number of feeds available!
we are still missing ~20 feeds for GLD to open up!
Quote from: alt on September 16, 2014, 02:47:16 AM
ok, support param ALL now,
Thanks for the script, alt.
I'm using
./btsx_feed_auto.py ALL now
Quote from: bitder on September 16, 2014, 01:43:35 PM
Quote from: alt on September 16, 2014, 02:47:16 AM
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.
Quote from: Riverhead on September 16, 2014, 02:56:36 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
Also I modified the code to average also over poloniex and bitrex .. and doe some other stuff differently. ..
Quote from: 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
Works o.k. for me, thank you alt
updated: support PTS,PPC,LTC now
ui .. +5%
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
Quote from: bytemaster on September 25, 2014, 09:40:08 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
Quote from: 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
I want to change this to single run too :)
I thought about just having a single cronjob be run every 15 minutes or so and just update on "demand" ..
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.
Well done +5%
its python3 .. you need python3-requests
Quote from: xeroc on October 01, 2014, 10:33:10 PM
its python3 .. you need python3-requests
omg ur so fast, so how do I install these? I already have "apt-get install python"
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
Quote from: kokojie on October 01, 2014, 10:35:40 PM
Quote from: xeroc on October 01, 2014, 10:33:10 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
Quote from: 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
Now it's telling me "ImportError: No module named 'numpy'", but I already done "apt-get install python-numpy python-scipy"
python3-numpy
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?
Quote from: 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?
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.
Quote from: 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?
depends on how often you run the script .. and in the config there is a parameter called
"common2": "update the feed price at least 23.5 hours a time",
"max_update_hours": 23.5,
Quote from: xeroc on October 13, 2014, 06:57:32 AM
Quote from: 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?
depends on how often you run the script .. and in the config there is a parameter called
"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.
Quote from: 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?
you need to change the update rule, this is what I use now
"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
},
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?
Quote from: 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?
Updated riverhead-del-server-1. Thanks for staying on top of this :).
Quote from: alt on October 16, 2014, 01:30:00 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?
>>> 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")
updated
update: add source from yunbi.com
btc38 return time out many times. maybe because of their firewall.
please update from github for version 0.4.24-rc1
rename asset name: BTSX->BTS, GLD->GOLD, SLV->SILVER
remove PTS, PPC, LTC
updated but having following warning
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
Quote from: 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
there have been some changes into the json format lately .. current price update scripts don't work with the latest git head ...
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...... :'(
Quote from: 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 ...
Quote from: Vato_ on November 11, 2014, 02:54:59 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.
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
Quote from: Vato_ on November 11, 2014, 02:54:59 PM
Edit: with xeroc's script I get "Traceback (most recent call last):
File "/root/bts_feed/bts_feed_auto.py", line 4, in <module>
import requests
ImportError: No module named 'requests'
"
my script requires python3! and as such you need to also install requests for python3!
Quote from: Vato_ on November 11, 2014, 03:57:52 PM
OK so far. ;)
"python3 bts_feed_auto.py GOLD
Loading data: yahoo, BTC38Traceback (most recent call last):
File "bts_feed_auto.py", line 410, in <module>
fetch_from_btc38()
File "bts_feed_auto.py", line 72, in fetch_from_btc38
if "ticker" in result[coin.lower()] and result[coin.lower()]["ticker"] and float(result[coin.lower()]["ticker"]["last"])>config["minValidAssetPrice"]:
KeyError: 'minValidAssetPrice'
"
Should be this the expected result?
Looks like you are using my version of the script. It is not yet working on 0.4.24. I'll update it soon.
Details: https://bitsharestalk.org/index.php?topic=9698.0 (https://bitsharestalk.org/index.php?topic=9698.0)
@emski .. i added the exchange confidence to my script too
@vato_: please compare you config.json with the example config.json in the directory
Quote from: xeroc on November 11, 2014, 04:14:39 PM
@emski .. i added the exchange confidence to my script too
@vato_: please compare you config.json with the example config.json in the directory
If you've merged my changes then we dont need to maintain 2 versions of the script.
The diversity is achieved via the configuration where each delegate can configure its trust into exchanges.
Agreed ...
But i didn not merge your changes to the update rule and some others ... just the exchange importance and some error handling ..
Quote from: xeroc on November 11, 2014, 05:14:53 PM
Agreed ...
But i didn not merge your changes to the update rule and some others ... just the exchange importance and some error handling ..
I'll keep mine up to date then. I'd like to be able to use my update rule.
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
Quote from: alt on November 25, 2014, 01:28:09 AM
have updated:
1. need python3 now
2. please modify config.json, sample file is config-sample.json
3. now I computer feed price with weight, weight depends on depth, and scale.
support 5 exchange: btc38, yunbi, bter, BTS USD MARKET, BTS CNY MARKET
please use different scale, change file config.json
The link in OP to the github repo returns 404.
I'm having trouble getting this script to talk to bitshares through the RPC.
I have confirmed that doing this, yields a positive result:
curl --user `grep rpc_user ~/.BitShares/config.json | cut -d ":" -f 2 | tr -d " \",\n"`:`grep rpc_password ~/.BitShares/config.json | cut -d ":" -f 2 | tr -d " \",\n"` --data-binary '{"method":"about", "params": [], "json-rpc": 2.0, "id": 0}' -H 'content-type: text/plain;' http://localhost:9989/rpc
Yet every call to the feeds script results in an error about zero parameters and I can't even ctrl-c the script to stop it running. Any advice about how to diagnose this?
Traceback (most recent call last):
File "./bts_feed_auto.py", line 272, in <module>
fetch_price()
File "./bts_feed_auto.py", line 221, in fetch_price
print '{: >6}'.format("ASSET"), '{: >10}'.format("MEDIAN"), '{: >10}'.format("PUBLISH"), '{: >10}'.format("REAL"),'{: >8}'.format("CHANGE"),'{: >16}'.format("RATE(CNY/ASSET)"), "| CURRENT PRICE", time.strftime("(%Y%m%dT%H%M%S)", time.localtime(time.time()))
ValueError: zero length field name in format
p.s. I have configured the config script with the correct rpc username and password.
thanks, I forgot to update the link, rename btsx to bts
Quote from: emski on November 25, 2014, 07:33:09 AM
Quote from: alt on November 25, 2014, 01:28:09 AM
have updated:
1. need python3 now
2. please modify config.json, sample file is config-sample.json
3. now I computer feed price with weight, weight depends on depth, and scale.
support 5 exchange: btc38, yunbi, bter, BTS USD MARKET, BTS CNY MARKET
please use different scale, change file config.json
The link in OP to the github repo returns 404.
Just saw the notice about python3.
Now i'm getting this error:
python3 bts_feed_auto.py
File "bts_feed_auto.py", line 93
print "Warnning: rpc call error, retry 5 seconds later"
^
SyntaxError: invalid syntax
Any ideas?
Progress:
./bts_feed_auto.py
Traceback (most recent call last):
File "./bts_feed_auto.py", line 11, in <module>
import exchanges as ex
File "/root/bitshares/operation_tools/btsfeed/exchanges/__init__.py", line 1, in <module>
from exchanges.exchanges import Exchanges
File "/root/bitshares/operation_tools/btsfeed/exchanges/exchanges.py", line 5, in <module>
import statistics
ImportError: No module named 'statistics'
?
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
Quote from: svk on November 25, 2014, 08:22:31 PM
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
seems not work until now?
来自我的 HUAWEI P7-L00 上的 Tapatalk
Quote from: monsterer on November 25, 2014, 06:29:24 PM
Just saw the notice about python3.
Now i'm getting this error:
python3 bts_feed_auto.py
File "bts_feed_auto.py", line 93
print "Warnning: rpc call error, retry 5 seconds later"
^
SyntaxError: invalid syntax
Any ideas?
you need update scripts first
来自我的 HUAWEI P7-L00 上的 Tapatalk
Quote from: svk on November 25, 2014, 08:22:31 PM
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
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 )
I had to install the following to get feeds to work
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.
Quote from: svk on November 25, 2014, 08:22:31 PM
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
Just fixed it ...
Quote from: xeroc on November 26, 2014, 07:32:57 AM
Quote from: svk on November 25, 2014, 08:22:31 PM
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
Just fixed it ...
Yep. Me too. btc38 wasn't working yesterday for me. Now it looks OK.
Quote from: xeroc on November 26, 2014, 07:32:57 AM
Quote from: svk on November 25, 2014, 08:22:31 PM
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
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?
Quote from: emski on November 26, 2014, 07:35:21 AM
Quote from: xeroc on November 26, 2014, 07:32:57 AM
Quote from: svk on November 25, 2014, 08:22:31 PM
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
Just fixed it ...
Yep. Me too. btc38 wasn't working yesterday for me. Now it looks OK.
thx, fixed it too
Quote from: emski on November 26, 2014, 07:46:15 AM
Quote from: xeroc on November 26, 2014, 07:32:57 AM
Quote from: svk on November 25, 2014, 08:22:31 PM
@alt @xeroc @emski Looks like btc38 just changed BTSX to BTS, think you need to update your scripts. Or am I late discovering this?
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 ..
Anyone know what I need to install to get access to the 'statistics' module?
ImportError: No module named 'statistics'
Quote from: monsterer on November 26, 2014, 09:22:55 AM
Anyone know what I need to install to get access to the 'statistics' module?
ImportError: No module named 'statistics'
"pip install statistics" I guess?
I didn't need that one though but I'm using emski's version.
the statistics module should be a build-in module of python3!! (THREE!)
Quote from: xeroc on November 26, 2014, 09:35:28 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?
Quote from: monsterer on November 26, 2014, 11:17:49 AM
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.
if you are running ubuntu1404, you can try to find the file and check if the package install correct
alt@localhost:~/workspace/bitsuperlab/btsfeed$ dpkg -S /usr/lib/python3.4/statistics.py
libpython3.4-stdlib:amd64: /usr/lib/python3.4/statistics.py
Quote from: monsterer on November 26, 2014, 11:12:27 PM
Quote from: monsterer on November 26, 2014, 11:17:49 AM
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.
you could also check with
$ python3
import statistics
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 :)
Quote from: 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 :)
thank you , I'll add to the document :)
Do I need to configure anything special to get this script to update faster than once per day?
Quote from: 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?
config.json has update frequency set to 23.5 hours by default, you can change to anything you like.
My feeds quantity has suddenly dropped to zero on bitshareblocks.com, but the script is still running - any idea what could have happened?
Quote from: 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?
Provide script version, commandline arguments and output.
I can't find the version number anywhere, but the last tty output is this:
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:
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)
Quote from: monsterer on December 01, 2014, 09:33:51 AM
I can't find the version number anywhere, but the last tty output is this:
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:
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?
Quote from: svk on December 01, 2014, 10:55:34 AM
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.
Quote from: monsterer on December 01, 2014, 12:07:56 PM
Quote from: svk on December 01, 2014, 10:55:34 AM
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.
Mine froze too. I just restarted them and they are fine again.
Sent from my Timex Sinclair.
Quote from: emski on December 01, 2014, 12:12:05 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?
I have fixed some bug maybe cause this problem
please update to the latest
Quote from: monsterer on December 01, 2014, 09:33:51 AM
I can't find the version number anywhere, but the last tty output is this:
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:
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)
Quote from: alt on December 01, 2014, 02:44:22 PM
I have fixed some bug maybe cause this problem
please update to the latest
The freezing problem, or the btc38 problem?
both
Quote from: monsterer on December 01, 2014, 03:12:13 PM
Quote from: alt on December 01, 2014, 02:44:22 PM
I have fixed some bug maybe cause this problem
please update to the latest
The freezing problem, or the btc38 problem?
After latest git pull
bts_feed_auto.py stopped working.
It now just waits infinitely..
$ ./bts_feed_auto.py USD
I have installed
python3
python3-requests
python3-numpy
on Ubuntu. Also copied and updated new config.json
{
"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
}
}
watch the log file for error message
log-bts.txt
Quote from: bitcoinerS on December 01, 2014, 06:29:38 PM
After latest git pull
bts_feed_auto.py stopped working.
It now just waits infinitely..
$ ./bts_feed_auto.py USD
I have installed
python3
python3-requests
python3-numpy
on Ubuntu. Also copied and updated new config.json
{
"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
}
}
Quote from: alt on December 01, 2014, 11:48:26 PM
watch the log file for error message
log-bts.txt
Quote from: bitcoinerS on December 01, 2014, 06:29:38 PM
After latest git pull
bts_feed_auto.py stopped working.
It now just waits infinitely..
$ ./bts_feed_auto.py USD
I have installed
python3
python3-requests
python3-numpy
on Ubuntu. Also copied and updated new config.json
{
"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
}
}
$ 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
I have no idea about these logs...
try to remove the try{} except {} , and see what's wrong
while True:
try:
fetch_price()
display_price()
except:
logger.error("Warning: unknown error, can't fetch price")
time.sleep(sample_timer)
to
while True:
fetch_price()
display_price()
time.sleep(sample_timer)
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?
Quote from: alt on December 02, 2014, 01:34:08 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 :)
Quote from: xeroc on December 02, 2014, 07:04:24 AM
Quote from: alt on December 02, 2014, 01:34:08 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?
Quote from: alt on December 02, 2014, 01:30:57 AM
try to remove the try{} except {} , and see what's wrong
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:
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.
Quote from: wackou on December 02, 2014, 10:44:34 AM
Quote from: alt on December 02, 2014, 01:30:57 AM
try to remove the try{} except {} , and see what's wrong
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:
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
Quote from: alt on December 02, 2014, 07:19:55 AM
Quote from: xeroc on December 02, 2014, 07:04:24 AM
Quote from: alt on December 02, 2014, 01:34:08 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 ..
$ 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'
Quote from: bitcoinerS on December 02, 2014, 03:41:00 PM
$ 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.
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
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.
Quote from: 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.
do you know where to get the oil price?
I have no idea about hits...
Quote from: bitcoinerS on December 03, 2014, 03:26:22 AM
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
Quote from: alt on December 03, 2014, 04:03:33 AM
Quote from: 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.
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.
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
Why wouldn't you just take CLY0, which is the cash price?
Quote from: monsterer on December 03, 2014, 12:05:10 PM
Why wouldn't you just take CLY0, which is the cash price?
you know of a page that exposes CLY0 through an api?
Quote from: xeroc on December 03, 2014, 12:35:23 PM
Quote from: monsterer on December 03, 2014, 12:05:10 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.
Quote from: monsterer on December 03, 2014, 04:27:58 PM
Quote from: xeroc on December 03, 2014, 12:35:23 PM
Quote from: monsterer on December 03, 2014, 12:05:10 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.
Quote from: chsln on December 03, 2014, 05:44:18 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?
Hello
I have set-up price feeds on my delegate using the following code to run in a tmux terminal:
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.
===================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
Quote from: bitcoinerS on December 05, 2014, 06:38:54 PM
Still getting errors..
git clone https://github.com/Bitsuperlab/operation_tools.git
cd operation_tools/btsfeed
cp config-sample.json config.json
./bts_feed_auto.py ALL
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
Quote from: alt on December 03, 2014, 04:04:21 AM
Quote from: bitcoinerS on December 03, 2014, 03:26:22 AM
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
update for version 0.4.25
But I have no idea about this problem, the rpc call is failed.
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'
Quote from: alt on December 09, 2014, 03:15:05 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.
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$
Works for my delegate even if it's not in the top 101
Quote from: chsln on December 09, 2014, 04:51:52 PM
Works for my delegate even if it's not in the top 101
Do you have clear log?
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.
Quote from: chsln on December 09, 2014, 04:51:52 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
Quote from: liondani on December 09, 2014, 09:56:50 PM
Quote from: chsln on December 09, 2014, 04:51:52 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.
Quote from: lafona on December 10, 2014, 01:50: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>
Quote from: xeroc on December 10, 2014, 03:17:51 PM
Quote from: lafona on December 10, 2014, 01:50: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!
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.
Quote from: 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.
you just publish price for USD,CNY,BTS,GOLD, you can run the command with parameter "ALL" to publish for all support asset.
Quote from: alt on December 22, 2014, 02:49:55 PM
Quote from: 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.
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 ;)
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...
Warning: unknown error, can't fetch price
'result'
some of the log results are:
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...
Quote from: 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...
Warning: unknown error, can't fetch price
'result'
some of the log results are:
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?
...
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.
The feed price script may need to be updated.
https://bitsharestalk.org/index.php/topic,15851.msg203639.html#msg203639
Quote from: 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
thanks, I'll check it
来自我的 HUAWEI P7-L00 上的 Tapatalk
I have update for bitshares v0.9
should support both v0.9 and v0.8 now
please use the new script:
https://bitsharestalk.org/index.php/topic,16170.msg213621.html#msg213621