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

v2.0 trade_buy and trade_sell problems #131

Open
Crimees opened this issue Jan 22, 2018 · 1 comment
Open

v2.0 trade_buy and trade_sell problems #131

Crimees opened this issue Jan 22, 2018 · 1 comment

Comments

@Crimees
Copy link

Crimees commented Jan 22, 2018

When submitting a trade_buy request to the v2.0 endpoint, we get this:

There was a problem processing your request. If this problem persists, please email [email protected] with this error id - a4e8ec80-1a22-4e9e-bece-dcaea19124c9

I've made some small fixes to the methods trade_buy and trade_sell and they now work off the bat. Unfortunately I don't know how/if I can directly make this suggestion with GIT, so here it is

`def trade_buy(self, market=None, order_type=None, quantity=None, rate=None, time_in_effect=TIMEINEFFECT_GOOD_TIL_CANCELLED,
condition_type=CONDITIONTYPE_NONE, target=0):
"""
Enter a buy order into the book
Endpoint
1.1 NO EQUIVALENT -- see buy_market or buy_limit
2.0 /key/market/tradebuy

    :param market: String literal for the market (ex: BTC-LTC)
    :type market: str
    :param order_type: ORDERTYPE_LIMIT = 'LIMIT' or ORDERTYPE_MARKET = 'MARKET'
    :type order_type: str
    :param quantity: The amount to purchase
    :type quantity: float
    :param rate: The rate at which to place the order.
        This is not needed for market orders
    :type rate: float
    :param time_in_effect: TIMEINEFFECT_GOOD_TIL_CANCELLED = 'GOOD_TIL_CANCELLED',
            TIMEINEFFECT_IMMEDIATE_OR_CANCEL = 'IMMEDIATE_OR_CANCEL', or TIMEINEFFECT_FILL_OR_KILL = 'FILL_OR_KILL'
    :type time_in_effect: str
    :param condition_type: CONDITIONTYPE_NONE = 'NONE', CONDITIONTYPE_GREATER_THAN = 'GREATER_THAN',
            CONDITIONTYPE_LESS_THAN = 'LESS_THAN', CONDITIONTYPE_STOP_LOSS_FIXED = 'STOP_LOSS_FIXED',
            CONDITIONTYPE_STOP_LOSS_PERCENTAGE = 'STOP_LOSS_PERCENTAGE'
    :type condition_type: str
    :param target: used in conjunction with condition_type
    :type target: float
    :return:
    """
    return self._api_query(path_dict={
        API_V2_0: '/key/market/TradeBuy'
    }, options={
        'marketName': market,
        'orderType': order_type,
        'quantity': quantity,
        'rate': rate,
        'timeInEffect': time_in_effect,
        'conditionType': condition_type,
        'target': target
    }, protection=PROTECTION_PRV)

`

` def trade_sell(self, market=None, order_type=None, quantity=None, rate=None, time_in_effect=TIMEINEFFECT_GOOD_TIL_CANCELLED,
condition_type=CONDITIONTYPE_NONE, target=0):
"""
Enter a sell order into the book
Endpoint
1.1 NO EQUIVALENT -- see sell_market or sell_limit
2.0 /key/market/tradesell

    :param market: String literal for the market (ex: BTC-LTC)
    :type market: str
    :param order_type: ORDERTYPE_LIMIT = 'LIMIT' or ORDERTYPE_MARKET = 'MARKET'
    :type order_type: str
    :param quantity: The amount to purchase
    :type quantity: float
    :param rate: The rate at which to place the order.
        This is not needed for market orders
    :type rate: float
    :param time_in_effect: TIMEINEFFECT_GOOD_TIL_CANCELLED = 'GOOD_TIL_CANCELLED',
            TIMEINEFFECT_IMMEDIATE_OR_CANCEL = 'IMMEDIATE_OR_CANCEL', or TIMEINEFFECT_FILL_OR_KILL = 'FILL_OR_KILL'
    :type time_in_effect: str
    :param condition_type: CONDITIONTYPE_NONE = 'NONE', CONDITIONTYPE_GREATER_THAN = 'GREATER_THAN',
            CONDITIONTYPE_LESS_THAN = 'LESS_THAN', CONDITIONTYPE_STOP_LOSS_FIXED = 'STOP_LOSS_FIXED',
            CONDITIONTYPE_STOP_LOSS_PERCENTAGE = 'STOP_LOSS_PERCENTAGE'
    :type condition_type: str
    :param target: used in conjunction with condition_type
    :type target: float
    :return:
    """
    rreturn self._api_query(path_dict={
        API_V2_0: '/key/market/TradeSell'
    }, options={
        'marketName': market,
        'orderType': order_type,
        'quantity': quantity,
        'rate': rate,
        'timeInEffect': time_in_effect,
        'conditionType': condition_type,
        'target': target
    }, protection=PROTECTION_PRV)

`

@MarkPatzelt
Copy link

Hi. I have had a problem with the trade_sell function and used your fix to solve the problem. The function returns the following data:
{'success': False, 'message': 'NO_API_RESPONSE', 'result': None}
I am using python-bittrex version 0.30
Python 3.6
Any idea?

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

No branches or pull requests

2 participants