buying and selling – Given a listing of purchase/promote orders and former trades, compute a purchase/promote value

0
56


It took fairly a little bit of pondering, however right here is the way you arrive at a “purchase immediately” or “promote immediately” value.

Shall we say you’ve purchase orders:

  1. purchase 100LTC at 5BTC
  2. purchase 50LTC at 4BTC
  3. purchase 200LTC at 3BTC

And promote orders:

  1. promote 100LTC at 6BTC
  2. promote 500LTC at 7BTC
  3. promote 100LTC at 8BTC

and so forth.

We are able to acquire rather a lot from this easy set of orders. For one, the market depth chart turns into very helpful when this knowledge. So, you may say that the market unfold is 1BTC on this case, as a result of purchase and promote orders are separated by 1BTC

Now, shall we say we’ve got 125LTC we need to promote. The best way you’d decide one of the best promote prompt value is to have a look at the purchase orders. Appears like you may promote your first 100LTC at 5BTC and the remaining 25LTC at 4BTC. So, 5BTC ought to be your max charge. Relying on the API you’re utilizing, you would possibly need to place two separate orders at totally different costs or place one with the max value assumed.

It really works the identical manner with shopping for. IF you need to purchase 650LTC, you’d be capable to purchase the primary 100LTC at 6BTC, after which the subsequent 500LTC at 7BTC and the final 50LTC at 8BTC. So, your max value can be 8BTC. Though your precise value would range quite a bit. It relies on what service and API you are utilizing as to the way to finest place such an order spanning costs.

For Cryptsy you’d place such a purchase order as only one order of 650LTC at 8BTC. Crypsty routinely chooses one of the best value for you, so you’d have this impact. Nonetheless, it is not assured to work this fashion. When you acquired the order record, and somebody was to purchase up 50BTC at 6BTC, then your anticipated value would find yourself being fallacious. In order for you a value assure, it’s best to place precise matching orders to the order guide. Following this methodology although, you’ve a excessive likelyhood of an order not finishing as effectively, or taking longer than anticipated, resembling in case you purchase 100LTC at 6BTC, however somebody purchased 50LTC already. Crypsty by default would wait some time earlier than finishing the partial order. (assuming no different promote orders have been positioned at that value)

It is really a extremely easy idea, but it surely took me a number of days to truly wrap my head round it for some purpose. Hopefully if different folks have the identical downside, perhaps this publish will clear issues up for them

LEAVE A REPLY

Please enter your comment!
Please enter your name here