Giter Club home page Giter Club logo

ob-analytics's People

Contributors

petr-fedorov avatar phil8192 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ob-analytics's Issues

Bitstamp's Live Orders API is not reliable for identification of trades

Bitstamp provides APIs for Live Orders and Live Ticker (i.e. trades) as described here . Sometimes Live Orders API outputs incorrect data as shown below.

Here is the trade record received from Live Ticker API:
2018-10-14 12-52-22
The record contains price and amount of trade as well as buy and sell order IDs.

Here is the records from Live Orders API for orders participated in the above trade:
2018-10-14 12-53-03

(both screenshots are taken from PostgreSQL database where the data received from API are saved)

Correct row 6 corresponds to sell order 2269748432. 'fill' column equals to trade amount, timing is ok etc.

Incorrect row 5 corresponds to the buy order. It is incorrect because it reports the cancellation of the buy order for 'amount' column didn't change comparing to the previous event for the order. That is equivalent to zero 'fill' - no trade.

Thus processData() function should probably handle the data from both APIs together to produce reliable results.

missing timestamps

Error: all(orders$timestamp %in% depth.summary$timestamp) is not TRUE
In addition: Warning messages:
1: In removeDuplicates(events) :
  removed 3 duplicate order cancellations: 195347950 195547832 195561334
2: In matchTrades(events) :
  03/10/17 : 226 jumps > $10 (swaping makers with takers)
3: In setOrderTypes(events, trades) : could not identify 6213 orders
4: In processData(paste0("csv/", day, ".csv")) :
  removed 1 duplicated updates
Execution halted

why do we need to infer the trades from orders? the log already has them

First, thank you for such a useful package! I am not familiar to bitstamp data so have this question:

I assume extdata/2015-05-01.log.xz is the raw market data recording, it already has trades in it. Why does the package spend time on inferring the trades from orders?

Screen Shot 2020-01-13 at 3 06 43 PM

the inferred trades count is 482

Screen Shot 2020-01-13 at 3 06 15 PM

parse.sh explicitly filters trades and generates the orders.csv

Screen Shot 2020-01-13 at 3 05 58 PM

the log has 575 trades, which is different from number of inferred trades.

the individual orders and trades are usually directly provided by exchanges, so why does the package spend time on inferring trades from orders?

Event map

Needs some work: does not look good with wide time period. + Maybe link "strategic run" events...

argument is of length zero

head -1 x/2017-03-10.csv >csv/2017-03-10.csv
tail -100000 x/2017-03-10.csv >>csv/2017-03-10.csv

processing 2017-03-10.csv...
Error in if (abs(this.jump$price - prev.jump$price) > 10) { : 
  argument is of length zero
Calls: processData -> matchTrades
In addition: Warning messages:
1: In removeDuplicates(events) :
  removed 2 duplicate order cancellations: 195547832 195561334
2: In matchTrades(events) :
  03/10/17 : 117 jumps > $10 (swaping makers with takers)
Execution halted

processData() does not always match a 'market' order with an appropriate 'limit' order so some trades are lost

Below is an excerpt from "Example limit order book data" (lob.data$events) showing 'changed' events for 'market' orders that do not have a corresponding limit order event (matching.event equals NA):

2018-10-02 17-58-04

It appears that the trades corresponding to the above events are missing from lob.data$trades . The total number of 'market' and 'market-limit' events with matching.event equals NA is 43 while the number of trades in lob.data$trades is 482. Thus approximately 8% of trades are missing?

Trade jumps

matchTrades function in trades.R sometimes returns incorrect trade price:

trades[2794:2797, ]
timestamp price volume direction maker.event.id taker.event.id maker taker
2799 2015-08-28 15:46:43.698 230.00 977822452 buy 247125 248210 80395773 80396310
2800 2015-08-28 15:46:43.736 230.03 22177548 buy 247037 248211 80395734 80396310
2804 2015-08-28 15:46:50.864 206.99 3000000 buy 248231 248240 80396320 80396322
2788 2015-08-28 15:46:50.894 229.39 36881731 sell 247643 248232 80396032 80396320

due to misclassification of maker order:

events[events$id == 80396320, c("id", "event.id", "price", "volume", "direction", "type")]
id event.id price volume direction type
247732 80396320 248230 206.99 120000000 ask market-limit
247734 80396320 248231 206.99 117000000 ask market-limit
247736 80396320 248232 206.99 80118269 ask market-limit
247738 80396320 248233 206.99 76501530 ask market-limit
247739 80396320 248234 206.99 11094362 ask market-limit
247742 80396320 248235 206.99 0 ask market-limit

longer object length is not a multiple of shorter object length

processing 2017-07-05.csv...
Warning messages:
1: In matchTrades(events) :
  07/05/17 : 1 jumps > $10 (swaping makers with takers)
2: In deleted[deleted$id %in% created.deleted.ids, ]$volume == created[created$id %in%  :
  longer object length is not a multiple of shorter object length
3: In setOrderTypes(events, trades) : could not identify 534784 orders

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.