mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
Added example of MARKET order with price=None
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
1.2.4
|
||||||
|
-) Added example of MARKET order with price=None
|
||||||
|
|
||||||
1.2.3
|
1.2.3
|
||||||
-) Tests adjusted
|
-) Tests adjusted
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import asyncio
|
|||||||
import time
|
import time
|
||||||
sys.path.append('../../../')
|
sys.path.append('../../../')
|
||||||
from bfxapi import Client
|
from bfxapi import Client
|
||||||
|
from bfxapi.models import OrderType
|
||||||
|
|
||||||
API_KEY=os.getenv("BFX_KEY")
|
API_KEY=os.getenv("BFX_KEY")
|
||||||
API_SECRET=os.getenv("BFX_SECRET")
|
API_SECRET=os.getenv("BFX_SECRET")
|
||||||
@@ -15,7 +16,7 @@ bfx = Client(
|
|||||||
)
|
)
|
||||||
|
|
||||||
async def create_order():
|
async def create_order():
|
||||||
response = await bfx.rest.submit_order("tBTCUSD", 10, 0.1)
|
response = await bfx.rest.submit_order(symbol="tBTCUSD", amount=10, price=None, market_type=OrderType.MARKET)
|
||||||
# response is in the form of a Notification object
|
# response is in the form of a Notification object
|
||||||
for o in response.notify_info:
|
for o in response.notify_info:
|
||||||
# each item is in the form of an Order object
|
# each item is in the form of an Order object
|
||||||
|
|||||||
@@ -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, Order.Type.EXCHANGE_MARKET)
|
await bfx.ws.submit_order(symbol='tBTCUSD', price=None, amount=0.01, market_type=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,4 +2,4 @@
|
|||||||
This module contains the current version of the bfxapi lib
|
This module contains the current version of the bfxapi lib
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = '1.2.3'
|
__version__ = '1.2.4'
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -11,7 +11,7 @@ from os import path
|
|||||||
here = path.abspath(path.dirname(__file__))
|
here = path.abspath(path.dirname(__file__))
|
||||||
setup(
|
setup(
|
||||||
name='bitfinex-api-py',
|
name='bitfinex-api-py',
|
||||||
version='1.2.3',
|
version='1.2.4',
|
||||||
description='Official Bitfinex Python API',
|
description='Official Bitfinex Python API',
|
||||||
long_description='A Python reference implementation of the Bitfinex API for both REST and websocket interaction',
|
long_description='A Python reference implementation of the Bitfinex API for both REST and websocket interaction',
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
|
|||||||
Reference in New Issue
Block a user