mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 03:54:08 +00:00
First pass at security price reference (#1388)
* First pass at security price reference
* Data cleanup
* Synth security fetching does better with a mic_code
* Update test suite
😭
* Update schema.rb
* Update generator.rb
This commit is contained in:
@@ -29,7 +29,7 @@ module Account::EntriesTestHelper
|
||||
end
|
||||
|
||||
def create_trade(security, account:, qty:, date:, price: nil)
|
||||
trade_price = price || Security::Price.find_by!(ticker: security.ticker, date: date).price
|
||||
trade_price = price || Security::Price.find_by!(security: security, date: date).price
|
||||
|
||||
trade = Account::Trade.new \
|
||||
qty: qty,
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
module SecuritiesTestHelper
|
||||
def create_security(ticker, prices:)
|
||||
security = Security.create!(
|
||||
ticker: ticker,
|
||||
exchange_mic: "XNAS"
|
||||
)
|
||||
|
||||
prices.each do |price|
|
||||
Security::Price.create! ticker: ticker, date: price[:date], price: price[:price]
|
||||
Security::Price.create!(
|
||||
security: security,
|
||||
date: price[:date],
|
||||
price: price[:price],
|
||||
currency: "USD"
|
||||
)
|
||||
end
|
||||
|
||||
Security.create! ticker: ticker
|
||||
security
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user