-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
71 lines (62 loc) · 1.7 KB
/
models.py
File metadata and controls
71 lines (62 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from logging import getLogger
from sqlalchemy import (
Column,
DateTime,
Float,
MetaData,
String,
Table,
Integer,
create_engine,
)
import os
logger = getLogger()
meta = MetaData()
collections = Table(
f"collections",
meta,
Column("collection_id", String, primary_key=True),
Column("collection_name", String),
Column("images", String),
Column("ticker", String),
Column("floor_price", Float),
Column("best_offer", Float),
Column("volume_eth", Float),
Column("delta_percentage", Float),
Column("listings_number", Float),
Column("offers_eth", Float),
Column("mover_rank", Integer),
)
pools = Table(
f"pools",
meta,
Column("pool_address", String, primary_key=True),
Column("collection_id", String),
Column("collection_name", String),
Column("images", String),
Column("ticker", String),
Column("bonding_curve", String),
Column("bonding_delta", Float),
Column("swap_fee", Float),
Column("floor_price", Float),
Column("best_offer", Float),
Column("volume_eth", Float),
Column("delta_percentage", Float),
Column("listings_number", Float),
Column("offers_eth", Float),
)
collections_timeseries = Table(
f"collections_timeseries",
meta,
Column("collection_id", String, primary_key=True),
Column("datetime", DateTime, primary_key=True),
Column("tx_number", Float),
Column("txn_price", Float),
Column("volume_eth", Float),
Column("listings_number", Float),
Column("offers_eth", Float),
)
def migrate():
logger.info("Running migration to create all tables")
engine = create_engine(os.environ["POSTGRES_JBDC"], echo=False)
meta.create_all(engine)