Package: opentick
OpenTickOpenTick is a fast tick database for financial timeseries data, built onFoundationDBwith simplified SQL layer. Here is the Python binding for OpenTick Database. For more information, please checkOpenTradeSolutions website.Features:Built-in price adjustment supportNanosecond supportPython, C++ and Go SDKBoth sync and async queryImplicit SQL statement prepareInstallation on UbuntuYou need to useGo >=1.11which has module support.sudoaptinstall-ypythonwgethttps://www.foundationdb.org/downloads/6.0.18/ubuntu/installers/foundationdb-server_6.0.18-1_amd64.debwgethttps://www.foundationdb.org/downloads/6.0.18/ubuntu/installers/foundationdb-clients_6.0.18-1_amd64.debsudodpkg-ifoundationdb-clients_6.0.18-1_amd64.debfoundationdb-server_6.0.18-1_amd64.debgitclonehttps://github.com/opentradesolutions/opentickmakebuildsudoaptinstallnodejssudonpminstall-gpm2pm2start./opentickNote:FoundationDB runs in memory storage mode and only one process by default. You can change it to disk storage as belows:user@host$fdbclifdb>configuressdFore more configuration on FoundationDB, please checkFoundationDB ConfigurationUsagePythonC++GoPerformance100k ohlcv bar inserted in 1 second.user@host:~/opentick/bindings/go$goruntest.go2018/11/2721:27:234.500470184s5.500314708s0100000allinsertfuturesgetdone2018/11/2721:27:25861.306778ms1.139363333s010allbatchinsertfuturesgetdone2018/11/2721:27:26805.542584ms100000retrievedwithranges2018/11/2721:27:271.782497936s100000retrievedwithasync2018/11/2721:27:291.424262818s100000retrievedwithonesyncuser@host:~/opentick/bindings/python$./test.py2018-11-2721:29:10.1681380:00:00.2005770:00:06.7249910100000allinsertfuturesgetdone2018-11-2721:29:12.1925700:00:00.1765400:00:00.959563010allbatchinsertfuturesgetdone2018-11-2721:29:13.4600250:00:01.267462100000retrievedwithranges2018-11-2721:29:15.0776860:00:01.617666100000retrievedwithasync2018-11-2721:29:16.7770430:00:01.699361100000retrievedwithonesyncuser@host:~/opentick/bindings/cpp$maketest21:33:19.231156889:4.22207s4.84954s0100000allinsertfuturesgetdone21:33:20.172744180:0.447708s0.934337s010allbatchinsertfuturesgetdone21:33:21.677161076:1.49497s100000retrievedwithasyncSample Code (C++)Create database and tableautoconn=Connection::Create("127.0.0.1",1116);conn->Start();conn->Execute("create database if not exists test");conn->Use("test");conn->Execute(R"(create table if not exists test(sec int, interval int, tm timestamp,
    open double, high double, low double, close double, v double, vwap
    double, primary key(sec, interval, tm)))");Execute// opentick prepares the sql statement automatically, no need to prepare explicitlyautofut=conn->ExecuteAsync("select * from test where sec=1 and interval=?",Args{1}));autores=fut->Get();// blocked wait until execution done
// Get last 2 rows ordering by primary keyautores=conn->Execute("select tm from test where sec=1 and interval=? limit -2",Args{1});Insertstaticconststd::stringkInsert="insert into test(sec, interval, tm, open, high, low, close, vol, vwap) ""values(?, ?, ?, ?, ?, ?, ?, ?, ?)";std::vector<Future>futs;for(autoi=0;i<1000;++i){futs.push_back(conn->ExecuteAsync(kInsert,Args{1,1,system_clock::now(),2.2,2.4,2.1,2.3,1000000,2.25}));}// wait for all insertion donefor(autofut:futs)fut->Get();Batch InsertArgssargss;for(autoi=0;i<1000;++i){argss.push_back(Args{1,i,system_clock::now(),2.2,2.4,2.1,2.3,1000000,2.25});}conn->BatchInsert(kInsert,argss);Price Adjustmentsautores=conn->Execute("select tm, adj(open), adj(high), adj(low), adj(close), adj(vol) from test where sec=1 and interval=? limit -2",Args{1});For more details, please checkoutadj_test.go