mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-20 07:14:20 +01:00
examples: use Order.Type enum in order submit
This commit is contained in:
@@ -2,7 +2,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
sys.path.append('../')
|
sys.path.append('../')
|
||||||
|
|
||||||
from bfxapi import Client
|
from bfxapi import Client, Order
|
||||||
|
|
||||||
API_KEY=os.getenv("BFX_KEY")
|
API_KEY=os.getenv("BFX_KEY")
|
||||||
API_SECRET=os.getenv("BFX_SECRET")
|
API_SECRET=os.getenv("BFX_SECRET")
|
||||||
@@ -33,6 +33,6 @@ def log_error(msg):
|
|||||||
@bfx.ws.once('authenticated')
|
@bfx.ws.once('authenticated')
|
||||||
async def submit_order(auth_message):
|
async def submit_order(auth_message):
|
||||||
# create an inital order a really low price so it stays open
|
# create an inital order a really low price so it stays open
|
||||||
await bfx.ws.submit_order('tBTCUSD', 10, 1, 'EXCHANGE LIMIT')
|
await bfx.ws.submit_order('tBTCUSD', 10, 1, Order.Type.EXCHANGE_LIMIT)
|
||||||
|
|
||||||
bfx.ws.run()
|
bfx.ws.run()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
sys.path.append('../')
|
sys.path.append('../')
|
||||||
|
|
||||||
from bfxapi import Client
|
from bfxapi import Client, Order
|
||||||
|
|
||||||
API_KEY=os.getenv("BFX_KEY")
|
API_KEY=os.getenv("BFX_KEY")
|
||||||
API_SECRET=os.getenv("BFX_SECRET")
|
API_SECRET=os.getenv("BFX_SECRET")
|
||||||
@@ -34,7 +34,7 @@ def log_error(msg):
|
|||||||
|
|
||||||
@bfx.ws.on('authenticated')
|
@bfx.ws.on('authenticated')
|
||||||
async def submit_order(auth_message):
|
async def submit_order(auth_message):
|
||||||
await bfx.ws.submit_order('tBTCUSD', 19000, 0.01, 'EXCHANGE LIMIT')
|
await bfx.ws.submit_order('tBTCUSD', 19000, 0.01, Order.Type.EXCHANGE_MARKET)
|
||||||
|
|
||||||
# If you dont want to use a decorator
|
# If you dont want to use a decorator
|
||||||
# ws.on('authenticated', submit_order)
|
# ws.on('authenticated', submit_order)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
sys.path.append('../')
|
sys.path.append('../')
|
||||||
|
|
||||||
from bfxapi import Client
|
from bfxapi import Client, Order
|
||||||
|
|
||||||
API_KEY=os.getenv("BFX_KEY")
|
API_KEY=os.getenv("BFX_KEY")
|
||||||
API_SECRET=os.getenv("BFX_SECRET")
|
API_SECRET=os.getenv("BFX_SECRET")
|
||||||
@@ -36,6 +36,6 @@ def log_error(msg):
|
|||||||
@bfx.ws.once('authenticated')
|
@bfx.ws.once('authenticated')
|
||||||
async def submit_order(auth_message):
|
async def submit_order(auth_message):
|
||||||
# create an inital order a really low price so it stays open
|
# create an inital order a really low price so it stays open
|
||||||
await bfx.ws.submit_order('tBTCUSD', 10, 1, 'EXCHANGE LIMIT')
|
await bfx.ws.submit_order('tBTCUSD', 10, 1, Order.Type.EXCHANGE_LIMIT)
|
||||||
|
|
||||||
bfx.ws.run()
|
bfx.ws.run()
|
||||||
|
|||||||
Reference in New Issue
Block a user