Code Monkey home page Code Monkey logo

cpptrade's Introduction

Summary

C++ order booking trading / matching engine

Dependencies

Building and installing

This uses the standard autotools pattern:

$ ./autogen.sh
$ CXXFLAGS="-O2 -Wall -g -I/usr/local/include/evhtp" ./configure
$ make			# compile
$ make check		# run tests
$ sudo make install	# install on system

Interface

obsrv speaks JSON-RPC over HTTP.

Test client

A test client cli.js is available. Run ./cli.js help for a summary of example commands:

$ ./cli.js help
Commands:
info				Show server info
market.list			Show all markets
market.add SYMBOL [booktype]	Add new market
book SYMBOL [depth]		Show order book
order order-id			Show info on a single order
order.cancel order-id		Cancel a single order
order.modify order-id		Modify a single order
order.add [json order info]	Add new order

cpptrade's People

Contributors

jgarzik 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

cpptrade's Issues

univalue.h not found error

Errors on make. bitcoin (no wallet) is installed.

Util.cc:13:22: fatal error: univalue.h: No such file or directory
 #include <univalue.h>
                      ^
compilation terminated.
Makefile:703: recipe for target 'Util.o' failed
make[1]: *** [Util.o] Error 1
make[1]: Leaving directory '/root/cpptrade'
Makefile:577: recipe for target 'all' failed
make: *** [all] Error 2
root@localhost:~/cpptrade# make check
g++ -DHAVE_CONFIG_H -I.  -std=c++11 -pthread -I./vendor/liquibook/src   -O2 -Wall -g -I/usr/local/include/evhtp -MT Util.o -MD -MP -MF .deps/Util.Tpo -c -o Util.o Util.cc
Util.cc:13:22: fatal error: univalue.h: No such file or directory
 #include <univalue.h>
                      ^
compilation terminated.
Makefile:703: recipe for target 'Util.o' failed
make: *** [Util.o] Error 1

Compile errors, cannot convert.

I'm getting lots of errors like this, any advice?

usr/lib/gcc/x86_64-amazon-linux/4.8.5/include/emmintrin.h: In function âvoid _mm_stream_si128(__m128i*, __m128i)â:
/usr/lib/gcc/x86_64-amazon-linux/4.8.5/include/emmintrin.h:1447:53: error: cannot convert â__v2di* {aka long long int*}â to â__vector(2) long long intâ for argument â1â to âvoid __builtin_ia32_movntdq(__vector(2) long long int, __vector(2) long long int)â
__builtin_ia32_movntdq ((__v2di *)__A, (__v2di)__B);

Thanks

error: ‘evhtp_set_regex_cb’ was not declared in this scope

g++ -DHAVE_CONFIG_H -I.  -std=c++11 -pthread -I./vendor/liquibook/src   -O2 -Wall -g -I/usr/local/include/evhtp -MT srvapi.o -MD -MP -MF .deps/srvapi.Tpo -c -o srvapi.o srvapi.cc
In file included from ./vendor/liquibook/src/book/order_book.h:12:0,
                 from ./vendor/liquibook/src/book/depth_order_book.h:6,
                 from Market.h:6,
                 from srvapi.cc:17:
./vendor/liquibook/src/book/comparable_price.h: In member function ‘bool liquibook::book::ComparablePrice::operator!=(liquibook::book::Price) const’:
./vendor/liquibook/src/book/comparable_price.h:89:21: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
     return ! price_ == rhs;
                     ^~
mv -f .deps/srvapi.Tpo .deps/srvapi.Po
g++ -DHAVE_CONFIG_H -I.  -std=c++11 -pthread -I./vendor/liquibook/src   -O2 -Wall -g -I/usr/local/include/evhtp -MT obsrv.o -MD -MP -MF .deps/obsrv.Tpo -c -o obsrv.o obsrv.cc
In file included from ./vendor/liquibook/src/book/order_book.h:12:0,
                 from ./vendor/liquibook/src/book/depth_order_book.h:6,
                 from Market.h:6,
                 from obsrv.cc:20:
./vendor/liquibook/src/book/comparable_price.h: In member function ‘bool liquibook::book::ComparablePrice::operator!=(liquibook::book::Price) const’:
./vendor/liquibook/src/book/comparable_price.h:89:21: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
     return ! price_ == rhs;
                     ^~
obsrv.cc: In function ‘int main(int, char**)’:
obsrv.cc:397:74: error: ‘evhtp_set_regex_cb’ was not declared in this scope
    cb = evhtp_set_regex_cb(htp, apiEnt->path, apiEnt->cb, (void *) apiEnt);
                                                                          ^
Makefile:703: recipe for target 'obsrv.o' failed
make[1]: *** [obsrv.o] Error 1
make[1]: Leaving directory '/root/cpptrade'
Makefile:577: recipe for target 'all' failed
make: *** [all] Error 2

Happens during make.

Dependencies/subdependencies installed:

  • libevent2.1.8
  • libevhtp
  • oniguruma
  • rocksdb
  • univalue
  • OpenSSL 1.0.2

What could be wrong?

Issue on mac os x 10.10.5

When I try make, I get the following

In file included from ./vendor/liquibook/src/book/depth_order_book.h:6:
./vendor/liquibook/src/book/order_book.h:481:8: warning: unused variable 'price_change' [-Wunused-variable]
bool price_change = new_price && (new_price != order->price());
^
In file included from obsrv.cc:24:
./srv.h:37:3: warning: 'SHA256_Init' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
SHA256_Init(&bodyHash);
^
/usr/include/openssl/sha.h:147:5: note: 'SHA256_Init' has been explicitly marked deprecated here
int SHA256_Init(SHA256_CTX *c) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
^
obsrv.cc:79:28: error: use of undeclared identifier 'htparser_get_methodstr_m'; did you mean 'htparser_get_methodstr'?
const char *method_name = htparser_get_methodstr_m(method);
^~~~~~~~~~~~~~~~~~~~~~~~
htparser_get_methodstr
./htparse.h:93:16: note: 'htparser_get_methodstr' declared here
const char * htparser_get_methodstr(htparser *);
^
obsrv.cc:79:53: error: cannot initialize a parameter of type 'htparser *' with an lvalue of type 'htp_method'
const char *method_name = htparser_get_methodstr_m(method);
^~~~~~
./htparse.h:93:49: note: passing argument to parameter here
const char * htparser_get_methodstr(htparser *);
^
obsrv.cc:107:2: warning: 'SHA256_Update' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
SHA256_Update(&state->bodyHash, chunk, bufsz);
^
/usr/include/openssl/sha.h:148:5: note: 'SHA256_Update' has been explicitly marked deprecated here
int SHA256_Update(SHA256_CTX *c, const void *data, size_t len) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
^
obsrv.cc:153:72: error: expected ')'
evhtp_request_set_hook (req, evhtp_hook_on_request_fini, (evhtp_hook) req_finish_cb, state);
^

Make check giving me error

i successfully able to compile it but when i running 'make check' it saying fail

===================================
cscpp 0.0.1: ./test-suite.log

TOTAL: 1

PASS: 0

SKIP: 0

XFAIL: 0

FAIL: 1

XPASS: 0

ERROR: 0

.. contents:: :depth: 2

FAIL: obsrv-tests.sh

Daemon not started.
FAIL obsrv-tests.sh (exit status: 1)

qw

Runing testcli.js is not working

$ ./testcli.js
module.js:471
throw err;
^

Error: Cannot find module 'async'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/alex/cpptrade/testcli.js:4:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
alex@ubuntu:~/cpptrade$

Hi, it looks like something is missing from project :)

cannot compile cpptrade on ubuntu 16.04

Even after installing univalue I'm getting this error.

g++ -O2 -g -Wall -I/home/uss/Work/Trade_Server/libevhtp-develop/build/include -I/home/uss/Work/Trade_Server/libevhtp-develop/include -pthread -o obsrv srvapi.o obsrv.o Market.o Order.o HttpUtil.o libobcommon.a -levhtp -lunivalue -levent_core -levent_openssl -lssl -lcrypto -luuid
/usr/bin/x86_64-linux-gnu-ld: cannot find -lunivalue

There are no files getting installed in /usr directory of univalue

Kindly help

Issues while compling

I get the following -
g++ -O2 -Wall -g -I/usr/local/include/evhtp -pthread -L/usr/lib -o obsrv srvapi.o obsrv.o Market.o Order.o HttpUtil.o libobcommon.a -levhtp -lunivalue -levent_core -levent_openssl -lssl -lcrypto -luuid
obsrv.o: In function reqInit(evhtp_request*, ReqState*, HttpApiEntry const*) [clone .constprop.71]': ~/cpptrade/obsrv.cc:153: undefined reference to evhtp_request_set_hook'
obsrv.o: In function upload_headers_cb(evhtp_request*, evhtp_kvs*, void*)': ~/cpptrade/obsrv.cc:245: undefined reference to evhtp_request_set_hook'
obsrv.o: In function main': ~/cpptrade/obsrv.cc:405: undefined reference to evhtp_callback_set_hook'
collect2: error: ld returned 1 exit status
Makefile:685: recipe for target 'obsrv' failed

No idea why. I've compiled successfuly the libevthp, but something (some reference is not found there).
Any idea ?

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.