feat: ✨ add optional quote_symbol to ticker entity
the quote symbol represents the currency in which the ticker is quoted. e.g.: USD, ARS, etc
This commit is contained in:
parent
b8d83c6fff
commit
ff02cb2157
@ -77,4 +77,11 @@ tasks:
|
|||||||
deps:
|
deps:
|
||||||
- release:pre
|
- release:pre
|
||||||
cmds:
|
cmds:
|
||||||
- cargo release patch --execute
|
- cargo release patch --execute
|
||||||
|
|
||||||
|
fmt+lint:
|
||||||
|
desc: 🎨🧶 format and lint rustler
|
||||||
|
cmds:
|
||||||
|
- task fmt
|
||||||
|
- git add .
|
||||||
|
- task lint
|
||||||
@ -14,6 +14,7 @@ impl MigrationTrait for Migration {
|
|||||||
.if_not_exists()
|
.if_not_exists()
|
||||||
.col(ColumnDef::new(Ticker::Id).string().not_null().primary_key())
|
.col(ColumnDef::new(Ticker::Id).string().not_null().primary_key())
|
||||||
.col(ColumnDef::new(Ticker::Symbol).string().not_null())
|
.col(ColumnDef::new(Ticker::Symbol).string().not_null())
|
||||||
|
.col(ColumnDef::new(Ticker::QuoteSymbol).string().null())
|
||||||
.col(ColumnDef::new(Ticker::MarketId).string().not_null())
|
.col(ColumnDef::new(Ticker::MarketId).string().not_null())
|
||||||
.foreign_key(
|
.foreign_key(
|
||||||
ForeignKey::create()
|
ForeignKey::create()
|
||||||
@ -45,6 +46,9 @@ enum Ticker {
|
|||||||
Id,
|
Id,
|
||||||
/// Ticker symbol (e.g. "GOOGL")
|
/// Ticker symbol (e.g. "GOOGL")
|
||||||
Symbol,
|
Symbol,
|
||||||
|
/// Quote symbol (e.g. "USD"): represents the currency in which the ticker is quoted.
|
||||||
|
/// Could be null, and it will imply USD
|
||||||
|
QuoteSymbol,
|
||||||
/// Market ID
|
/// Market ID
|
||||||
MarketId,
|
MarketId,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ pub struct Model {
|
|||||||
#[sea_orm(primary_key, auto_increment = false)]
|
#[sea_orm(primary_key, auto_increment = false)]
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub symbol: String,
|
pub symbol: String,
|
||||||
|
pub quote_symbol: Option<String>,
|
||||||
pub market_id: String,
|
pub market_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,8 @@ message Empty { }
|
|||||||
message Ticker {
|
message Ticker {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
string symbol = 2;
|
string symbol = 2;
|
||||||
string market_id = 3;
|
optional string quote_symbol = 3;
|
||||||
|
string market_id = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Tickers {
|
message Tickers {
|
||||||
|
|||||||
@ -20,6 +20,7 @@ impl Ticker {
|
|||||||
ticker::Model {
|
ticker::Model {
|
||||||
id: self.id,
|
id: self.id,
|
||||||
symbol: self.symbol,
|
symbol: self.symbol,
|
||||||
|
quote_symbol: self.quote_symbol,
|
||||||
market_id: self.market_id,
|
market_id: self.market_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -29,6 +30,7 @@ impl Ticker {
|
|||||||
Self {
|
Self {
|
||||||
id: model.id,
|
id: model.id,
|
||||||
symbol: model.symbol,
|
symbol: model.symbol,
|
||||||
|
quote_symbol: model.quote_symbol,
|
||||||
market_id: model.market_id,
|
market_id: model.market_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user