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

0 Members and 1 Guest are viewing this topic.

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
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...

Offline Riverhead

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.

Offline bitcoinerS

  • Hero Member
  • *****
  • Posts: 592
    • View Profile
Code: [Select]
Warning: unknown error, can't fetch price
2014-12-02 19:23:54,204[ERROR]: 'result'
Traceback (most recent call last):
  File "./bts_feed_auto.py", line 197, in <module>
    fetch_price()
  File "./bts_feed_auto.py", line 100, in fetch_price
    price_depth["bts_usd"] = client.get_depth_in_range("USD","BTS", depth_change)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 43, in get_depth_in_range
    price = self.get_price(quote,base)
  File "/home/bitcoiners/dev/projects/operation_tools/btsfeed/bts.py", line 233, in get_price
    order = response.json()["result"]
KeyError: 'result'


latest git pull
>>> approve bitcoiners

Offline alt

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

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


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

« Last Edit: December 02, 2014, 11:51:37 pm by alt »

Offline bitcoinerS

  • Hero Member
  • *****
  • Posts: 592
    • View Profile

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


>>> approve bitcoiners

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
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 ..

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
try to remove the try{} except {} , and see what's wrong
Code: [Select]
while True:
  try:
    fetch_price()
    display_price()
  except:
    logger.error("Warning: unknown error, can't fetch price")
  time.sleep(sample_timer)

Small tip: if you want to see what exception was raised, but still want to catch it, you can do it like so:
Code: [Select]
while True:
  try:
    fetch_price()
    display_price()
  except Exception as e:
    logger.error("Warning: unknown error, can't fetch price")
    logger.exception(e)
  time.sleep(sample_timer)
which will print the exception type, message and stack trace.
I don't know that, thank you very much.  :P
I'll add this

Offline wackou

try to remove the try{} except {} , and see what's wrong
Code: [Select]
while True:
  try:
    fetch_price()
    display_price()
  except:
    logger.error("Warning: unknown error, can't fetch price")
  time.sleep(sample_timer)

Small tip: if you want to see what exception was raised, but still want to catch it, you can do it like so:
Code: [Select]
while True:
  try:
    fetch_price()
    display_price()
  except Exception as e:
    logger.error("Warning: unknown error, can't fetch price")
    logger.exception(e)
  time.sleep(sample_timer)
which will print the exception type, message and stack trace.
Please vote for witness wackou! More info at http://digitalgaia.io

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
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?

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
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 :)

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
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?
« Last Edit: December 02, 2014, 01:35:51 am by alt »

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
I have no idea about these logs...
try to remove the try{} except {} , and see what's wrong
Code: [Select]
while True:
  try:
    fetch_price()
    display_price()
  except:
    logger.error("Warning: unknown error, can't fetch price")
  time.sleep(sample_timer)
to
Code: [Select]
while True:
    fetch_price()
    display_price()
    time.sleep(sample_timer)

Offline bitcoinerS

  • Hero Member
  • *****
  • Posts: 592
    • View Profile
watch the log file for error message
log-bts.txt
After latest git pull
bts_feed_auto.py stopped working.
It now just waits infinitely..
Code: [Select]
$ ./bts_feed_auto.py USD

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

on Ubuntu. Also copied and updated new config.json

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

Code: [Select]
$ cat log-bts.txt
2014-11-30 22:56:28,284[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 22:57:49,674[ERROR]: Error fetching results from bter!
2014-11-30 22:57:49,675[ERROR]: Error get price from bter!
2014-11-30 22:57:51,969[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 22:59:16,253[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 23:00:24,598[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 23:01:29,085[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 23:02:38,847[ERROR]: Error fetching results from yunbi!
2014-11-30 23:02:38,847[ERROR]: Error get price from yunbi!
2014-11-30 23:02:38,905[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 23:03:47,831[ERROR]: Warning: unknown error, can't fetch price
2014-11-30 23:04:55,646[ERROR]: Warning: unknown error, can't fetch price
>>> approve bitcoiners

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
watch the log file for error message
log-bts.txt
After latest git pull
bts_feed_auto.py stopped working.
It now just waits infinitely..
Code: [Select]
$ ./bts_feed_auto.py USD

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

on Ubuntu. Also copied and updated new config.json

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

Offline bitcoinerS

  • Hero Member
  • *****
  • Posts: 592
    • View Profile
After latest git pull
bts_feed_auto.py stopped working.
It now just waits infinitely..
Code: [Select]
$ ./bts_feed_auto.py USD

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

on Ubuntu. Also copied and updated new config.json

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