Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add "1Sec" to queryable timeframe list #201

Merged
merged 4 commits into from
Mar 17, 2019

Conversation

dakimura
Copy link
Contributor

@dakimura dakimura commented Mar 9, 2019

I just added "1Sec" timeframe to the queryable timeframe list... and confirmed that "1Sec" timeframe is working now

cli = pymkts.Client()
data = [
        np.array([(pd.Timestamp('2019-03-07 00:00:00').value / 10**9, 1, 2, 0)],dtype=[('Epoch', 'i8'), ('Bid', 'f4'), ('Ask', 'f4'), ('Nanoseconds', 'i4')]),
        np.array([(pd.Timestamp('2019-03-07 00:00:00').value / 10**9, 3, 4, 1)],dtype=[('Epoch', 'i8'), ('Bid', 'f4'), ('Ask', 'f4'), ('Nanoseconds', 'i4')]),
        np.array([(pd.Timestamp('2019-03-07 00:00:00').value / 10**9, 5, 6, 2)],dtype=[('Epoch', 'i8'), ('Bid', 'f4'), ('Ask', 'f4'), ('Nanoseconds', 'i4')]),
        np.array([(pd.Timestamp('2019-03-07 00:00:00').value / 10**9, 7, 8, 3)],dtype=[('Epoch', 'i8'), ('Bid', 'f4'), ('Ask', 'f4'), ('Nanoseconds', 'i4')]),
]
for record in data:
        print( cli.write(record, "TEST/1Sec/TICK", isvariablelength=True) )


show command

» \show TEST/1Sec/TICK 1970-01-01
=============================  ==========  ==========  ==========  
                        Epoch  Bid         Ask         Nanoseconds  
=============================  ==========  ==========  ==========  
2019-03-07 00:00:00 +0000 UTC    1           2           0           
2019-03-07 00:00:00 +0000 UTC    3           4           1           
2019-03-07 00:00:00 +0000 UTC    5           6           2           
2019-03-07 00:00:00 +0000 UTC    7           8           3           
=============================  ==========  ==========  ========== 

query using pymkts

>>> reply = cli.query( pymkts.Params('TEST', '1Sec', 'TICK', limit=10) )
>>> print( reply.first().df() )

                           Bid  Ask  Nanoseconds
Epoch
2019-03-07 00:00:00+00:00  1.0  2.0            0
2019-03-07 00:00:00+00:00  3.0  4.0            1
2019-03-07 00:00:00+00:00  5.0  6.0            2
2019-03-07 00:00:00+00:00  7.0  8.0            3

@dakimura dakimura changed the title add 1Sec to queryable timeframes [WIP] add 1Sec to queryable timeframe list Mar 9, 2019
@@ -2,15 +2,18 @@
# Commands to automate integration tests
################################################################################

LATEST_TAG ?= $(shell bin/dockertags alpacamarkets/marketstore | tail -1)
IMAGE_NAME ?= alpacamarkets/marketstore:${LATEST_TAG}
IMAGE_NAME ?= alpacahq/integrationtests.marketstore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this pull request, integration test was being run to the latest marketstore image that was already pushed.
In order to run the integration test to the code written in the pull request, we need to create docker image of marketstore every time a pull request is created

@@ -2,403 +2,403 @@
1970-01-02 21:37:57 +0000 UTC,1.05185,1.05197,139999992
1970-01-03 21:37:57 +0000 UTC,1.05185,1.05197,139999992
2016-12-30 21:37:57 +0000 UTC,1.05185,1.05197,139999992
2016-12-30 21:38:02 +0000 UTC,1.05185,1.05198,389999986
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I added the rounding to minimize the cancellation error of Nanoseconds,
( https://github.com/alpacahq/marketstore/pull/201/files#diff-c387d7519eb758ef8432f6eba7f1e99dR52 )
I needed to change the expected nanosecond values of existing test for CSV import

@dakimura dakimura changed the title [WIP] add 1Sec to queryable timeframe list add "1Sec" to queryable timeframe list Mar 10, 2019
@gamella
Copy link

gamella commented Mar 17, 2019

@umitanuki @Notargets not urgent, but we want to use 1Sec time bucket in our next project. Can you review this PR?

@Notargets Notargets self-requested a review March 17, 2019 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants