Skip to content

Commit

Permalink
add index to open time
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-kleiner committed Jun 23, 2018
1 parent e774039 commit ab15313
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion binance_db/candle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import binance_db.util.constants.ws as ws
import binance_db.util.constants.rest as rest
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, Integer, Float, DateTime
from sqlalchemy import Column, String, Integer, Float, DateTime, Index

Base = declarative_base()

Expand All @@ -22,6 +22,11 @@ class Candle(Base):
tbbav = Column(Float)
tbqav = Column(Float)

__table_args__ = (
Index('open_time_asc', open_time.asc(), postgresql_using='btree'),
Index('open_time_desc', open_time.desc(), postgresql_using='btree'),
)

def __init__(self, pair, kline):
self.pair = pair
self.open_time = self.to_date(kline[rest.OPEN_TIME])
Expand Down

0 comments on commit ab15313

Please sign in to comment.