Skip to content

See below for helloworld strategy

HelloWorld

1. Install godzilla.dev from source

Follow Installation to install godzill.dev on your local or cloud machine

2. Start master/ledger/md/td

Switch to root and goto helloworld scripts directory

sudo su
cd ~/dev/godzilla-community/scripts/helloworld
bash run.sh start

You should see the 4 service instances:

pm2 ls
welcome screen

3. Run helloworld strategy

Switch to project home directory

cd ~/dev/godzilla-community/
python core/python/dev_run.py -l trace strategy -n helloworld -p ~/dev/godzilla-community/strategies/helloworld/helloworld.py -c ~/dev/godzilla-community/strategies/helloworld/conf.json

You should see the breakpoint

4. Go through helloworld code

The logic is very simple in this demo

in pre_start function we subscribe the depth data of a list of symbols for a md source

and handle the stream depth data in on_depth call back function

from kungfu.wingchun.constants import *
from pywingchun.constants import Side, InstrumentType, OrderType

exchange = Exchange.BINANCE
instrument_type = InstrumentType.Spot

def pre_start(context):
    config = context.get_config()
    context.subscribe(config["md_source"], [config["symbol"]], instrument_type, exchange)

def on_depth(context, depth):
    breakpoint()
    context.log().info(depth)