Author Topic: Running pricefeed scprits on Windows  (Read 1845 times)

0 Members and 1 Guest are viewing this topic.

Offline checkrasier

  • Jr. Member
  • **
  • Posts: 33
    • View Profile

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
very cool ..
you mind if I copy&paste this instructions into the docs of the python libs?

Offline checkrasier

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
If your setting up a witness node on Windows here are the steps I used to get xeroc pricefeed scripts publishing on Windows   

1. Download and Install Python 3.5.0 (32-bit) for Windows:
https://www.python.org/ftp/python/3.5.0/python-3.5.0.exe

Do a Full install so pip gets included in the installation
Check - Add Python 3.5 to PATH

Optional: Change Pyhton's install directory to C:\Python 3.5

2. Install required python libs

Open Command Prompt and run:
pip install requests
pip install prettytable
pip install autobahn

NumPy is required but it has to be complied with Visual Stuido or mingw32.
If you have a complier configured with python:
pip install numpy

You can also download a precompiled verion here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
Download - numpy‑1.10.1+mkl‑cp35‑none‑win32.whl
Move to this file to C:\

pip install c:\numpy-1.10.1+mkl-cp35-none-win32.whl

3. Download and install python-graphenelib from xeroc GitHub.
https://github.com/xeroc/python-graphenelib
Select download ZIP
Extract zip file to C:\

Open command prompt:
cd C:\python-graphenelib-master
python setup.py install --user

4. Configure Pricefeeds:
In the C:\python-graphenelib-master\scripts\pricefeeds folder
Rename config-example.py to config.py

Edit config.py with IDLE and change:
host = "127.0.0.1"
port = 8092
delegate_name = "your_witness"
enable_yunbi = False
maximum_short_squeeze_ratio  = 1100

5. Run CLI wallet 
Open Command Prompt or create .bat file

cd C:\Program Files\BitShares 2\bin\
cli_wallet --rpc-http-endpoint="127.0.0.1:8092" -s ws://127.0.0.1:8090

unlock your wallet.  Wallet must be unlocked to publish price feeds.

6. Run the pricefeeds scripts
Open Command Prompt
python "C:\python-graphenelib-master\scripts\pricefeeds\pricefeeds.py"

If everything worked correctly you should get a Y/N confirmation to publish feeds

7. Using Windows Scheduler to run the pricefeed scripts every 60 mins
If you don't what to have repeat step 6 every 60 mins create a task in Windows Scheduler.

Create a pricefeeds.bat file containing:
echo Y|C:\Python3.5\python.exe "C:\python-graphenelib-master\scripts\pricefeeds\pricefeeds.py "

(The echo Y| confirms the price feed update.)

Open Task Scheduler:
Control Panel - System and Security - Administrative Tools - Task Scheduler

Select Create Task...

On the General Tab
Name: pricefeeds
Select "Run whether user is logged on or not"

On the Triggers Tab
Select New
Begin the task On a schedule - One Time - Set Start Date at Time for your pricefeed update
Check the Repeat task every: 1 hour for a duration of Indefinitely
Check Enabled

On the Actions Tab
Select New
Action: Start a program
Browse to the pricefeed.bat file you created
OK

Your witness should now be publishing updated pricefeeds every 60 minutes. 

Thank you to all everyone that help get this working!