Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submitting a buy order not working #92

Closed
carsonpo opened this issue May 24, 2018 · 4 comments
Closed

Submitting a buy order not working #92

carsonpo opened this issue May 24, 2018 · 4 comments
Labels

Comments

@carsonpo
Copy link

Versions

OS:      MacOS Sierra 
Python:   3.6
krakenex:  current

What are you trying to achieve?

Submit a buy/sell order. I am using the extension to this API pykrakenapi

Here is that API's way of submitting an order:

def add_standard_order(self, pair, type, ordertype, volume, price=None,
                           price2=None, leverage=None, oflags=None, starttm=0,
                           expiretm=0, userref=None, validate=True,
                           close_ordertype=None, close_price=None,
                           close_price2=None, otp=None,
                           trading_agreement='agree'):

        # create data dictionary
        if validate is False:
            validate = None
        data = {arg: value for arg, value in locals().items() if
                arg != 'self' and value is not None}

        # query
        res = self.api.query_private('AddOrder', data=data)

        # check for error
        if len(res['error']) > 0:
            raise KrakenAPIError(res['error'])

        return res['result']

and when I run this in my program:

buy = k.add_standard_order("XXBTZUSD", "buy", "market", 0.002)

print(buy)

it prints: {'descr': {'order': 'buy 0.00200000 XBTUSD @ market'}}

What do you expect to happen?

I would expect it to submit an order to my account

What happens instead?

My account never reflects that an order was submitted at all

I feel like there is something really simple that I should be doing, but I've been working on trying to fix this for several hours now and I have no idea what I'm supposed to do.

Thanks for all the help!

@veox
Copy link
Owner

veox commented May 25, 2018

With just krakenex, placing an order like this:

response = kraken.query_private('AddOrder', {'pair': 'XXBTZEUR', 'type': 'buy', 'ordertype': 'market', 'volume': : '0.002'})

Results in a response:

{'error': [],
 'result': {'descr': {'order': 'buy 0.00200000 XBTEUR @ market'},
  'txid': ['TRANSA-CTION-IDHERE']}}

And an appropriate balance change, along with entries on the "Trades" tab, and two entries in the ledger (on the "Overview" tab).

Try making volume a str, i.e. '0.002' instead of 0.002. (In general, though, either should work.)

EDIT: Also, this shows the txid, which pykrakenapi omits.


In either case, this looks like a pykrakenapi issue, so best report there.

Since an external package is involved, and it works as expected on this end, tagging as invalid.

@veox veox added the invalid label May 25, 2018
@veox veox closed this as completed Jul 20, 2018
@skapin
Copy link

skapin commented Jul 7, 2019

@carsonpo I don't know if you have found the solution of your probleme. If you do, you could have post here.

Otherwise, you order failed because, as written in the API, you have to put the flag validate to False to submit the order. Otherwise, it's only a check

    validate : bool, optional (default=True)
        Validate inputs only.  Do not submit order (default).

@goodboy
Copy link

goodboy commented Feb 8, 2022

So I'm curious, can validate=True be used as a form of paper trading or does kraken not fake fills on their end?

Is this just purely for validating the AddOrder request i guess?

@jonnymaserati
Copy link

jonnymaserati commented Feb 8, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants