Skip to content

Commit

Permalink
Merge pull request #4 from olned/v-0-1-0
Browse files Browse the repository at this point in the history
v0.1.0
  • Loading branch information
olned authored Jun 16, 2020
2 parents 2f96579 + 4b26a55 commit cba8efc
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 18 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# ssc2ce-cpp
A set of C++ parsers for ssc2ce

# Acknowledgements
The project uses:
- [pibind11](https://github.com/pybind/pybind11)
- [Catch2](), Boost Software License 1.0
A set of C++ parsers for [ssc2ce](https://github.com/olned/ssc2ce-python)

This is more of a pilot project, if you have any wishes for adding exchanges or expanding functionality, please register issues.
5 changes: 5 additions & 0 deletions python-bindings/py_book.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright Oleg Nedbaylo 2020.
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE
// or copy at http://www.boost.org/LICENSE_1_0.txt

#pragma once
#include <common/book_l2.hpp>
#include <pybind11/pybind11.h>
Expand Down
5 changes: 5 additions & 0 deletions python-bindings/ssc2ce_cpp.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright Oleg Nedbaylo 2020.
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE
// or copy at http://www.boost.org/LICENSE_1_0.txt

#include "py_book.hpp"
#include <deribit/parser.hpp>
#include <pybind11/functional.h>
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ def finalize_options(self):

setup(
name='ssc2ce_cpp',
version='0.0.2',
version='0.1.0',
author='Oleg Nedbaylo',
author_email='olned64@gmail.com',
description='A test project using pybind11 and CMake',
description='A set of C++ parsers for ssc2ce',
long_description=long_description,
ext_modules=[CMakeExtension('ssc2ce_cpp')],
cmdclass=dict(build_ext=CMakeBuild, bdist_wheel=bdist_wheel),
Expand Down
21 changes: 11 additions & 10 deletions src/deribit/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ bool DeribitParser::parse(const char *message)
return false;
}

last_error_msg_.clear();

using namespace rapidjson;
rapidjson::Document doc;
doc.Parse(message);
Expand Down Expand Up @@ -186,16 +188,15 @@ bool DeribitParser::parse_book(const char *channel, const rapidjson::Value &data
return result;
}

DeribitBookL2 &DeribitParser::find_or_create_book(const std::string_view &instrumnet)
{
if (auto p = books_.find(instrumnet); p != books_.end()) {
return p->second;
} else {
auto [x, ok] = books_.emplace(instrumnet, DeribitBookL2(std::string(instrumnet)));
return x->second;
}
};

DeribitBookL2 &DeribitParser::find_or_create_book(const std::string_view &instrumnet)
{
if (auto p = books_.find(instrumnet); p != books_.end()) {
return p->second;
} else {
auto [x, ok] = books_.emplace(instrumnet, DeribitBookL2(std::string(instrumnet)));
return x->second;
}
};

BookL2 const *DeribitParser::get_book(const std::string_view &instrument)
{
Expand Down
5 changes: 5 additions & 0 deletions tests/deribit_parser_test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright Oleg Nedbaylo 2020.
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE
// or copy at http://www.boost.org/LICENSE_1_0.txt

#include <catch.hpp>
#include <deribit/parser.hpp>

Expand Down
5 changes: 5 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright Oleg Nedbaylo 2020.
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE
# or copy at http://www.boost.org/LICENSE_1_0.txt

from unittest import TestCase, main
import ssc2ce_cpp as m

Expand Down

0 comments on commit cba8efc

Please sign in to comment.