Skip to content

New Order Example #76

@gtman002

Description

@gtman002

Versions

OS:       Win 10
Python:   3.6.3
krakenex: 3

What are you trying to achieve?

I want to write a python program to place a new order, and am wondering what type of feedback I should be expecting from the Kraken API. I have installed Krakenex with pip3 and can succesfully look up balances and get a response as expected, but when I run code for new order, I get an appropriate pause (3 - 10 seconds), but no response at all. No error, or anything.

# code sample
import krakenex
from requests.exceptions import HTTPError

k = krakenex.API()
k.load_key('kraken.key')

tradepair = 'LTCUSD'
volume_units = 1
buy_price = 1
sell_price = 1000


k.query_private('AddOrder',
                {'pair': tradepair,
                 'type': 'buy',
                 'ordertype': 'limit',
                 'price': buy_price,
                 'volume': volume_units,
                 # only `ordertype`, `price` and `price2` are valid
                 'close[ordertype]': 'limit',
                 'close[price]': sell_price,
                 # these will be ignored!
                 'close[pair]': tradepair,
                 'close[type]': 'sell',
                 'close[volume]': volume_units})

What do you expect to happen?

I would expect to get a response of some sort that has TXID, or an error message saying I don't have enough USD to complete the order.

What happens instead?

After a pause, I get a command prompt.

# error message
no error messages

I have no balance, so I don't expect the trade order to be successful, but I would expect something back.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions