Gekko Forum
Limit/Market Trades - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: General Discussion (https://forum.gekko.wizb.it/forum-14.html)
+--- Thread: Limit/Market Trades (/thread-57335.html)



Limit/Market Trades - mr.davis - 07-11-2018

Hey everybody,

I used the search function but couldn't find any thread about this.
For my live Gekko I changed in the bitfinex.js the code from "exchange limit" to "exchange market".
One friend who is into coding and all the stuff told me, that he looked up into the Gekko source code and that Gekko only can run on limit market trades. Is that right?

Thanks for your help.
Asmike thanks for such a great tool!


RE: Limit/Market Trades - askmike - 07-12-2018

Quote:One friend who is into coding and all the stuff told me, that he looked up into the Gekko source code and that Gekko only can run on limit market trades. Is that right?

He is exactly right as of this moment. However I am in the process of updating this (read below). Note that Gekko doesn't just put 1 limit order in the orderbook, it will constantly move and adjust this order around the orderbook using something called a "sticky order" (Note this is a gekko concept and does not exist on exchanges). See here for more info: https://gekko.wizb.it/docs/gekko-broker/sticky_order.html

Quote:For my live Gekko I changed in the bitfinex.js the code from "exchange limit" to "exchange market".

I love people hacking gekko's code, it's an open project and you can do whatever you want with it. That said: These kind of changes might result in Gekko behaving weird: If you do market orders and Gekko tries to follow up on the order (which Gekko still thinks is a limit order) and it isn't there you can get Gekko trying to create it again and things like that. Also it might be able figure out details of the executed trade.

----

Recently I released Gekko 0.6 which is a major release. It comes with a new library called Gekko Broker that will very soon be able to a lot more than sticky orders. First step will be stop orders, see discussion here: https://forum.gekko.wizb.it/thread-57314.html but we will definitely need market orders asap for situations where people are trading on very iliquid markets (small coins and such).


RE: Limit/Market Trades - mr.davis - 07-12-2018

thanks mike for your reply!
you're awesome  Cool


RE: Limit/Market Trades - mark.sch - 07-12-2018

Maybe I am facing a similar issue right now - working on exchange code for the new gekko broker.

The portfolio is saying 200 MTC (Docademic) tokens, Gekko then gets an advice to go short and is placing an order with 100 MTC. Is this part of the sticky order strategy or is something else going wrong? However, this order gets never fulfilled or changed by gekko later. Will try to debug. Is there any plugin available to read keystrokes in CLI mode to fire certain events? As a workaround, I extended the telegrambot now to get some Gekko control during CLI runtime...

The output was:

2018-07-10 08:25:54 (INFO): Trader Received advice to go short. Selling MTC
ask 0.214313 bid 0.210347
[ccxt-hitbtc2] (getTicker) ask 0.214313 bid 0.210347
2018-07-10 08:25:55 (INFO): Send advice via email.
[ccxt-hitbtc2] (getPortfolio) portfolio: [ { name: 'MTC', amount: 200 },
{ name: 'USDT', amount: 11.047655 } ]
2018-07-10 08:25:59 (DEBUG): [ORDER] statusChange: SUBMITTED
[ccxt-hitbtc2] (sell) added order with txid: b69e6439e86b4ddeac2f6d0a9cdf3fc0
2018-07-10 08:25:59 (DEBUG): [ORDER] statusChange: OPEN
[ccxt-hitbtc2] (checkOrder) result { id: 'b69e6439e86b4ddeac2f6d0a9cdf3fc0',
timestamp: 1531203959770,
datetime: '2018-07-10T06:25:59.770Z',
lastTradeTimestamp: 1531203959770,
status: 'open',
symbol: 'MTC/USDT',
type: 'limit',
side: 'sell',
price: 0.214313,
amount: 100,
cost: 0,
filled: 0,
remaining: 100,
fee: undefined,
info:
{ id: 40930118235,
clientOrderId: 'b69e6439e86b4ddeac2f6d0a9cdf3fc0',
symbol: 'MTCUSD',
side: 'sell',
status: 'new',
type: 'limit',
timeInForce: 'GTC',
quantity: '100',
price: '0.214313',
cumQuantity: '0',
createdAt: '2018-07-10T06:25:59.770Z',
updatedAt: '2018-07-10T06:25:59.770Z' } }
2018-07-10 08:26:01 (DEBUG): [ORDER] statusChange: REJECTED
2018-07-10 08:26:01 (INFO): [ORDER] summary: { price: 0,
amount: 0,
date: moment("1970-01-01T01:00:00.000"),
side: 'sell',
orders: 1 }
2018-07-10 08:26:01 (DEBUG): syncing portfolio
ask 0.214311 bid 0.210347
[ccxt-hitbtc2] (getTicker) ask 0.214311 bid 0.210347
[ccxt-hitbtc2] (getPortfolio) portfolio: [ { name: 'MTC', amount: 100 },
{ name: 'USDT', amount: 11.047655 } ]
2018-07-10 08:26:06 (DEBUG): WARNING: exchange did not provide fee information, assuming no fees..
2018-07-10 08:26:14 (DEBUG): Requested MTC/USDT trade data from hitbtc2 ...
2018-07-10 08:26:14 (DEBUG): Processing 2 new trades. From 2018-07-10 06:25:54 UTC to 2018-07-10 06:25:55 UTC. (a few seconds). Last price: 0.210347
2018-07-10 08:26:34 (DEBUG): Requested MTC/USDT trade data from hitbtc2 ...
2018-07-10 08:26:34 (DEBUG): No new trades.


Hope to finish the hitbtc exchange soon, the debugging needs prevent me to sell this dropping coin manually, ouchhh ;-)


RE: Limit/Market Trades - askmike - 07-12-2018

Quote:Gekko then gets an advice to go short and is placing an order with 100 MTC. Is this part of the sticky order strategy or is something else going wrong?

Something else is definitely going wrong there. Current sticky order does not break up lot into fractions.

Quote:However, this order gets never fulfilled or changed by gekko later.

If your hitbtc code follows this interface: https://gekko.wizb.it/docs/extending/add_an_exchange.html everything should happen automatically.

Quote:2018-07-10 08:26:01 (DEBUG): [ORDER] statusChange: REJECTED

Rejected means Gekko Broker thought there was an error in creating the order OR when doing a getOrder call your code passed something like:

Code:
{ open: false, completed: false }

If you still have trouble please log all the values you are returning from your hitbtc code (to gekko broker) and put them in a gist or so.


RE: Limit/Market Trades - askmike - 07-13-2018

@mark.sch

A typo in the documentation was pointed out that might be related to your issue, see here: https://github.com/askmike/gekko/issues/2305