Skip to content

Commit

Permalink
Merge pull request #166 from timkpaine/lint
Browse files Browse the repository at this point in the history
fix lints
  • Loading branch information
timkpaine committed Feb 7, 2022
2 parents 257c2c7 + 656c6b4 commit 762fc12
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.9]
node-version: [12.x]
python-version: [3.9]
node-version: [14.x]
event-name: [push]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
node-version: [12.x]
node-version: [14.x]

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 4 additions & 1 deletion aat/cpp/include/aat/core/order_book/price_level.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ namespace core {
return orders.size();
}

std::shared_ptr<Order> operator[](int i) { return orders[i]; }
std::shared_ptr<Order>
operator[](int i) {
return orders[i];
}
explicit operator bool() const { return orders.size() > 0; }
using iterator = std::deque<std::shared_ptr<Order>>::iterator;
using const_iterator = std::deque<std::shared_ptr<Order>>::const_iterator;
Expand Down
6 changes: 4 additions & 2 deletions aat/cpp/include/aat/python/binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ PYBIND11_MODULE(binding, m) {
.def(py::init<Instrument&, ExchangeType&>())
.def(py::init<Instrument&, ExchangeType&, std::function<void(std::shared_ptr<Event>)>>())
.def("__repr__", &OrderBook::toString)
.def("__iter__", [](const OrderBook& o) { return py::make_iterator(o.begin(), o.end()); },
.def(
"__iter__", [](const OrderBook& o) { return py::make_iterator(o.begin(), o.end()); },
py::keep_alive<0, 1>()) /* Essential: keep object alive while iterator exists */
.def("setCallback", &OrderBook::setCallback)
.def_property("instrument", &OrderBook::getInstrument, nullptr)
Expand All @@ -121,7 +122,8 @@ PYBIND11_MODULE(binding, m) {
******************************/
py::class_<PriceLevel>(m, "_PriceLevelCpp")
.def(py::init<double, Collector&>())
.def("__iter__", [](const PriceLevel& pl) { return py::make_iterator(pl.cbegin(), pl.cend()); },
.def(
"__iter__", [](const PriceLevel& pl) { return py::make_iterator(pl.cbegin(), pl.cend()); },
py::keep_alive<0, 1>()) /* Essential: keep object alive while iterator exists */
.def("__getitem__", &PriceLevel::operator[])
.def("__bool__", &PriceLevel::operator bool)
Expand Down
6 changes: 4 additions & 2 deletions aat/cpp/src/core/order_book/order_book.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
namespace aat {
namespace core {

OrderBookIterator& OrderBookIterator::operator++() {
OrderBookIterator&
OrderBookIterator::operator++() {
// TODO

return *this;
}

std::shared_ptr<Order> OrderBookIterator::operator*() {
std::shared_ptr<Order>
OrderBookIterator::operator*() {
if (side == Side::SELL) {
return (*(order_book.sells.at(price_level)))[index_in_level];
} else {
Expand Down
18 changes: 7 additions & 11 deletions aat/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,17 +455,13 @@ async def processEvent(self, event: Event, strategy: Strategy = None) -> None:
continue

# TODO make cleaner? move to somewhere not in critical path?
if (
event.type
in (
EventType.TRADE,
EventType.OPEN,
EventType.CHANGE,
EventType.CANCEL,
EventType.DATA,
)
and not self.manager.dataSubscriptions(handler, event)
):
if event.type in (
EventType.TRADE,
EventType.OPEN,
EventType.CHANGE,
EventType.CANCEL,
EventType.DATA,
) and not self.manager.dataSubscriptions(handler, event):
continue

try:
Expand Down

0 comments on commit 762fc12

Please sign in to comment.