publish feed price automatic(From BitSuperLab)

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

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alt

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


Riverhead

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



Riverhead

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


puppies

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

alt

#10
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?

Riverhead




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?

alt

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?

puppies

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

xeroc

Yhea. .. switch the port over to

"httpd_endpoint": "127.0.0.1:9988",

and leave the RPC with something welse

puppies

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

alt

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

xeroc

#3
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)

muse-umum

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). 


alt

#1
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.