Use `pendulum` for timestamp parsing
parent
a3b2ba9ae9
commit
6e2e2fc03f
|
@ -40,7 +40,6 @@ from bidict import bidict
|
||||||
import msgpack
|
import msgpack
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
|
||||||
import tractor
|
import tractor
|
||||||
from trio_websocket import open_websocket_url
|
from trio_websocket import open_websocket_url
|
||||||
from anyio_marketstore import (
|
from anyio_marketstore import (
|
||||||
|
@ -268,7 +267,7 @@ def quote_to_marketstore_structarray(
|
||||||
'''
|
'''
|
||||||
if last_fill:
|
if last_fill:
|
||||||
# new fill bby
|
# new fill bby
|
||||||
now = timestamp(last_fill)
|
now = int(pendulum.parse(last_fill).timestamp)
|
||||||
else:
|
else:
|
||||||
# this should get inserted upstream by the broker-client to
|
# this should get inserted upstream by the broker-client to
|
||||||
# subtract from IPC latency
|
# subtract from IPC latency
|
||||||
|
@ -298,15 +297,6 @@ def quote_to_marketstore_structarray(
|
||||||
return np.array([tuple(array_input)], dtype=_quote_dt)
|
return np.array([tuple(array_input)], dtype=_quote_dt)
|
||||||
|
|
||||||
|
|
||||||
def timestamp(date, **kwargs) -> int:
|
|
||||||
'''
|
|
||||||
Return marketstore compatible 'Epoch' integer in nanoseconds
|
|
||||||
from a date formatted str.
|
|
||||||
|
|
||||||
'''
|
|
||||||
return int(pd.Timestamp(date, **kwargs).value)
|
|
||||||
|
|
||||||
|
|
||||||
@acm
|
@acm
|
||||||
async def get_client(
|
async def get_client(
|
||||||
host: str = 'localhost',
|
host: str = 'localhost',
|
||||||
|
|
Loading…
Reference in New Issue