Author Topic: [Python] Price Feed Script for BitShares 2.0  (Read 31878 times)

0 Members and 1 Guest are viewing this topic.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I cant give a recommendation because I am not an economist ... every pro comes with a con

Offline puppies

  • Hero Member
  • *****
  • Posts: 1659
    • View Profile
  • BitShares: puppies
I just merged a pull request of forum member "alt" which allows to define the collateral and short squeeze ratio.
Plese update the code and add the new configuration parameters

Is there a recommended default setting?  I'm afraid I am not exactly sure what these parameters do.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I just merged a pull request of forum member "alt" which allows to define the collateral and short squeeze ratio.
Plese update the code and add the new configuration parameters

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Code: [Select]
commit d6b19bc465fbd80021c20e814286cb4d27f8118d
Author: Fabian Schuh <mail@xeroc.org>
Date:   Wed Oct 14 12:54:00 2015 +0200

    Price Feed Script Update
   
    + added configuration variables to disable/enable exchanges
      New config Variables:
   
        ## Enable exchanges
        enable_yunbi             = True
        enable_btc38             = True
        enable_bter              = False
        enable_polonie           = True
        enable_bittrex           = True
        enable_btcavg            = True


Offline twitter

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
could please explain the usage of following parameters in red? 



################################################################################
## RPC-client connection information (required)
################################################################################
host   = "localhost"
port   = 8092
user   = ""
passwd = ""
unlock = ""




################################################################################
## Fine tuning
################################################################################
discount                 = 0.995
core_exchange_factor     = 1.05 # 5% surplus if paying fees in bitassets

minValidAssetPriceInBTC  = 0.00001
change_min               = 0.5
witness:

Offline twitter

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
witness:

Offline puppies

  • Hero Member
  • *****
  • Posts: 1659
    • View Profile
  • BitShares: puppies
it complains  "No module named 'grapheneapi'"

Code: [Select]
python3 pricefeeds.py

Traceback (most recent call last):
  File "pricefeeds.py", line 44, in <module>
    from grapheneapi import GrapheneAPI
ImportError: No module named 'grapheneapi'

You need to either install grapheneapi with
Code: [Select]
python3 setup.py install --user
or copy pricefeeds.py and config.py to the python-graphenelib directory and run it from there.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline twitter

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
it complains  "No module named 'grapheneapi'"

Code: [Select]
python3 pricefeeds.py

Traceback (most recent call last):
  File "pricefeeds.py", line 44, in <module>
    from grapheneapi import GrapheneAPI
ImportError: No module named 'grapheneapi'
witness:

Xeldal

  • Guest
I assume the issue is where I define -s "<ip-of-full/witness-node:port>"  from the directions:
programs/cli_wallet/cli_wallet --rpc-http-endpoint="127.0.0.1:8092" -s "<ip-of-full/witness-node:port>"

but I can't find anything that makes it happy here.

I use this
Code: [Select]
./cli_wallet -w oct5_w0 --chain-id 60e21871125ea9995fe498b7f68a87a85c6583725ea5448f6fd969c59a37df83 -s ws://127.0.0.1:8090 -H 127.0.0.1:8092

That did it.  Thank you Spectral.

Xeldal

  • Guest
Having trouble getting feeds going.  Using https://python-graphenelib.readthedocs.org/en/latest/pricefeed.html

In launching the wallet I get the following error:
Code: [Select]
:~/graphene/programs/cli_wallet# ./cli_wallet -w test_wallet --chain-id 60e21871125ea9995fe498b7f68a87a85c6583725ea5448f6fd969c59a37df83 -H 127.0.0.1:8092 -s "127.0.0.1:8090"   
Logging RPC to file: logs/rpc/rpc.log
638120ms th_a       main.cpp:114                  main                 ] key_to_wif( committee_private_key ): 5...W
638121ms th_a       main.cpp:118                  main                 ] nathan_pub_key: GPH...V
638121ms th_a       main.cpp:119                  main                 ] key_to_wif( nathan_private_key ): 5...3
638122ms th_a       main.cpp:166                  main                 ] wdata.ws_server: 127.0.0.1:8090
10 assert_exception: Assert Exception
uri.substr(0,3) == "ws:":
    {}
    th_a  websocket.cpp:600 connect

    {"uri":"127.0.0.1:8090"}
    th_a  websocket.cpp:621 connect

I have witness running with this command:
Code: [Select]
./witness_node --rpc-endpoint "127.0.0.1:8090"  --genesis-json oct5-genesis.json -d oct5 -s "104.236.51.238:2005" -s "104.236.144.84:1776" --witness-id '"1.6.24"' --private-key '["GPH...t","5...5"]'

I assume the issue is where I define -s "<ip-of-full/witness-node:port>"  from the directions:
programs/cli_wallet/cli_wallet --rpc-http-endpoint="127.0.0.1:8092" -s "<ip-of-full/witness-node:port>"

but I can't find anything that makes it happy here.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
As per request from the testnet thread I swapped quote and base for the core exchange rate price .. even though I am pretty certain about that it doesn't change anything .. 10 core/asset equals 0.1 asset/core
no matter how you do it :)

Offline spartako

  • Sr. Member
  • ****
  • Posts: 401
    • View Profile
wallet_account_set_approval spartako

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Forgot to mention that the current version requires manual confirmation of every feed. Hence you cant run it in a cronjob

Offline liondani

  • Hero Member
  • *****
  • Posts: 3737
  • Inch by inch, play by play
    • View Profile
    • My detailed info
  • BitShares: liondani
  • GitHub: liondani

Offline alt

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