You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

order-book

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

order-book - pypi Package Compare versions

Comparing version
0.5.0
to
0.6.0
+5
-0
CHANGES.md
## Changelog
### 0.6.0 (2022-10-19)
* Update: Drop support for python 3.7
* Feature: to_list method
* Bugfix: Initialize iterator correctly
### 0.5.0 (2022-08-23)

@@ -4,0 +9,0 @@ * Bugfix: fix segmentation fault when calculating checksum on empty orderbook

+7
-2
Metadata-Version: 2.1
Name: order-book
Version: 0.5.0
Version: 0.6.0
Summary: A fast orderbook implementation, in C, for Python

@@ -29,3 +29,3 @@ Home-page: https://github.com/bmoscon/orderbook

[![License](https://img.shields.io/badge/license-GLPv3-blue.svg)](LICENSE)
![Python](https://img.shields.io/badge/Python-3.7+-green.svg)
![Python](https://img.shields.io/badge/Python-3.8+-green.svg)
[![PyPi](https://img.shields.io/badge/PyPi-order--book-brightgreen)](https://pypi.python.org/pypi/order-book)

@@ -148,2 +148,7 @@ ![coverage-lines](https://img.shields.io/badge/coverage%3A%20lines-84.6%25-blue)

### 0.6.0 (2022-10-19)
* Update: Drop support for python 3.7
* Feature: to_list method
* Bugfix: Initialize iterator correctly
### 0.5.0 (2022-08-23)

@@ -150,0 +155,0 @@ * Bugfix: fix segmentation fault when calculating checksum on empty orderbook

@@ -342,2 +342,62 @@ /*

PyObject* SortedDict_tolist(SortedDict *self, PyObject *args, PyObject *kwargs)
{
static char* keywords[] = {"n_levels", NULL};
int n_levels = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i", keywords, &n_levels)) {
return NULL;
}
int data_len = PyDict_Size(self->data);
// Set n_levels to data_len if n_levels is the default value
if (n_levels == -1 | n_levels > data_len) {
n_levels = data_len;
}
if (EXPECT(PyErr_Occurred() != NULL, 0)) {
return NULL;
}
if (EXPECT(update_keys(self), 0)) {
return NULL;
}
PyObject *ret = PyList_New(n_levels);
if (EXPECT(!ret, 0)) {
return NULL;
}
for (int i = 0; i < n_levels; ++i) {
// new reference
PyObject *key = PySequence_GetItem(self->keys, i);
if (EXPECT(!key, 0)) {
return NULL;
}
// borrowed reference
PyObject *value = PyDict_GetItem(self->data, key);
if (EXPECT(!value, 0)) {
Py_DECREF(key);
return value;
}
// Build tuple of (i.e., key, value)
PyObject *tuple_entry = PyTuple_New(2);
if (EXPECT(!tuple_entry, 0)) {
Py_DECREF(key);
return NULL;
}
PyTuple_SET_ITEM(tuple_entry, 0, key);
Py_INCREF(value);
PyTuple_SET_ITEM(tuple_entry, 1, value);
// Add tuple to list
PyList_SET_ITEM(ret, i, tuple_entry);
}
return ret;
}
PyObject* SortedDict_truncate(SortedDict *self, PyObject *Py_UNUSED(ignored))

@@ -438,2 +498,9 @@ {

/* iterator methods */
PyObject *SortedDict_getiter(SortedDict *self)
{
Py_INCREF(self);
self->iterator_index = -1;
return self;
}
PyObject *SortedDict_next(SortedDict *self)

@@ -440,0 +507,0 @@ {

@@ -45,2 +45,3 @@ /*

PyObject* SortedDict_todict(SortedDict *self, PyObject *unused, PyObject *kwargs);
PyObject* SortedDict_tolist(SortedDict *self, PyObject *args, PyObject *kwargs);
PyObject* SortedDict_truncate(SortedDict *self, PyObject *Py_UNUSED(ignored));

@@ -54,2 +55,3 @@

PyObject *SortedDict_getiter(SortedDict *self);
PyObject *SortedDict_next(SortedDict *self);

@@ -73,2 +75,3 @@

{"to_dict", (PyCFunction) SortedDict_todict, METH_VARARGS | METH_KEYWORDS, "return a python dictionary, sorted by keys"},
{"to_list", (PyCFunction) SortedDict_tolist, METH_VARARGS | METH_KEYWORDS, "return a list of key, value tuple with length specified in input argument. if no argument is passed or the argument is larger than length of self->data, return items with length of self->data."},
{NULL}

@@ -105,3 +108,3 @@ };

.tp_as_sequence = &SortedDict_seq,
.tp_iter = PyObject_SelfIter,
.tp_iter = (getiterfunc) SortedDict_getiter,
.tp_iternext = (iternextfunc) SortedDict_next,

@@ -108,0 +111,0 @@ .tp_dictoffset = 0,

Metadata-Version: 2.1
Name: order_book
Version: 0.5.0
Version: 0.6.0
Summary: A fast orderbook implementation, in C, for Python

@@ -29,3 +29,3 @@ Home-page: https://github.com/bmoscon/orderbook

[![License](https://img.shields.io/badge/license-GLPv3-blue.svg)](LICENSE)
![Python](https://img.shields.io/badge/Python-3.7+-green.svg)
![Python](https://img.shields.io/badge/Python-3.8+-green.svg)
[![PyPi](https://img.shields.io/badge/PyPi-order--book-brightgreen)](https://pypi.python.org/pypi/order-book)

@@ -148,2 +148,7 @@ ![coverage-lines](https://img.shields.io/badge/coverage%3A%20lines-84.6%25-blue)

### 0.6.0 (2022-10-19)
* Update: Drop support for python 3.7
* Feature: to_list method
* Bugfix: Initialize iterator correctly
### 0.5.0 (2022-08-23)

@@ -150,0 +155,0 @@ * Bugfix: fix segmentation fault when calculating checksum on empty orderbook

# Orderbook
[![License](https://img.shields.io/badge/license-GLPv3-blue.svg)](LICENSE)
![Python](https://img.shields.io/badge/Python-3.7+-green.svg)
![Python](https://img.shields.io/badge/Python-3.8+-green.svg)
[![PyPi](https://img.shields.io/badge/PyPi-order--book-brightgreen)](https://pypi.python.org/pypi/order-book)

@@ -6,0 +6,0 @@ ![coverage-lines](https://img.shields.io/badge/coverage%3A%20lines-84.6%25-blue)

@@ -38,3 +38,3 @@ '''

name='order_book',
version='0.5.0',
version='0.6.0',
author="Bryant Moscon",

@@ -41,0 +41,0 @@ author_email="bmoscon@gmail.com",