Skip to content

Commit

Permalink
convert gas cost to float
Browse files Browse the repository at this point in the history
  • Loading branch information
harisang committed Feb 12, 2024
1 parent 443c8e9 commit babb2be
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/models/order_rewards_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def from_pdf_to_dune_records(cls, rewards_df: DataFrame) -> list[dict[str, Any]]
),
"quote_sell_amount": str(row["quote_sell_amount"]),
"quote_buy_amount": str(row["quote_buy_amount"]),
"quote_gas_cost": str(int(row["quote_gas_cost"])),
"quote_gas_cost": float(row["quote_gas_cost"]),
"quote_sell_token_price": float(row["quote_sell_token_price"]),
},
}
Expand Down
2 changes: 1 addition & 1 deletion src/sql/orderbook/order_rewards.sql
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ select
coalesce(protocol_fee_native_price, 0.0) as protocol_fee_native_price,
cast(oq.sell_amount as numeric(78, 0)) :: text as quote_sell_amount,
cast(oq.buy_amount as numeric(78, 0)) :: text as quote_buy_amount,
cast(oq.gas_amount * oq.gas_price as numeric(78, 0)) :: text as quote_gas_cost,
oq.gas_amount * oq.gas_price as quote_gas_cost,
oq.sell_token_price as quote_sell_token_price
from
trade_hashes
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_order_rewards_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_order_rewards_transformation(self):
"quote_sell_amount": [10000000000000000, 2000000000000000, 35000],
"quote_buy_amount": [1000, 2000, 10],
"quote_gas_cost": [
5000000000000000,
5000000000000000.15,
6000000000000000,
12000000000000000,
],
Expand All @@ -46,7 +46,7 @@ def test_order_rewards_transformation(self):
"protocol_fee_native_price": 1.0,
"quote_sell_amount": "10000000000000000",
"quote_buy_amount": "1000",
"quote_gas_cost": "5000000000000000",
"quote_gas_cost": 5000000000000000.15,
"quote_sell_token_price": 1.0,
},
},
Expand All @@ -64,7 +64,7 @@ def test_order_rewards_transformation(self):
"protocol_fee_native_price": 0.1,
"quote_sell_amount": "2000000000000000",
"quote_buy_amount": "2000",
"quote_gas_cost": "6000000000000000",
"quote_gas_cost": 6000000000000000,
"quote_sell_token_price": 250000000,
},
},
Expand All @@ -82,7 +82,7 @@ def test_order_rewards_transformation(self):
"protocol_fee_native_price": 0.0,
"quote_sell_amount": "35000",
"quote_buy_amount": "10",
"quote_gas_cost": "12000000000000000",
"quote_gas_cost": 12000000000000000,
"quote_sell_token_price": 100000000000000.0,
},
},
Expand Down

0 comments on commit babb2be

Please sign in to comment.