Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First pass at security price reference #1388

Merged
merged 7 commits into from
Oct 29, 2024
Merged

Conversation

Shpigford
Copy link
Member

No description provided.

@Shpigford
Copy link
Member Author

@zachgoll No tests have been updated, but wanting a sanity check from you when you get a chance.

@Shpigford Shpigford marked this pull request as ready for review October 29, 2024 17:31
Copy link
Collaborator

@zachgoll zachgoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran everything locally and works good.

Just a quick diff on generator.rb so rake demo_data:reset works:

maybe $ git diff app/models/demo/generator.rb 
diff --git a/app/models/demo/generator.rb b/app/models/demo/generator.rb
index ba210b2..b56ef1b 100644
--- a/app/models/demo/generator.rb
+++ b/app/models/demo/generator.rb
@@ -176,12 +176,12 @@ class Demo::Generator
 
     def load_securities!
       # Create an unknown security to simulate edge cases
-      Security.create! ticker: "UNKNOWN", name: "Unknown Demo Stock"
+      Security.create! ticker: "UNKNOWN", name: "Unknown Demo Stock", exchange_mic: "UNKNOWN"
 
       securities = [
-        { ticker: "AAPL", name: "Apple Inc.", reference_price: 210 },
-        { ticker: "TM", name: "Toyota Motor Corporation", reference_price: 202 },
-        { ticker: "MSFT", name: "Microsoft Corporation", reference_price: 455 }
+        { ticker: "AAPL", exchange_mic: "NASDAQ", name: "Apple Inc.", reference_price: 210 },
+        { ticker: "TM", exchange_mic: "NYSE", name: "Toyota Motor Corporation", reference_price: 202 },
+        { ticker: "MSFT", exchange_mic: "NASDAQ", name: "Microsoft Corporation", reference_price: 455 }
       ]
 
       securities.each do |security_attributes|
@@ -193,7 +193,7 @@ class Demo::Generator
           low_price = reference - 20
           high_price = reference + 20
           Security::Price.create! \
-            ticker: security.ticker,
+            security: security,
             date: date,
             price: Faker::Number.positive(from: low_price, to: high_price)
         end

@Shpigford Shpigford merged commit 490f445 into main Oct 29, 2024
5 checks passed
@Shpigford Shpigford deleted the security-prices-reference branch October 29, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants