Тёмный

Using the Arduino to Evaluate the Stock Market 

2Bit
Подписаться 1 тыс.
Просмотров 212
50% 1

Опубликовано:

 

26 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 1   
@2bit661
@2bit661 10 месяцев назад
// sample code, copy and paste, have fun! #include void setup() { Serial.begin(9600); // Initialize serial communication } void loop() { // Input metrics float peRatio, debtToEquityRatio, profitMargin; // Prompt user for input using Serial Monitor Serial.println("Enter the P/E Ratio:"); while (!Serial.available()) { // Wait for user input } peRatio = Serial.parseFloat(); Serial.println("Enter the Debt to Equity Ratio:"); while (!Serial.available()) { // Wait for user input } debtToEquityRatio = Serial.parseFloat(); Serial.println("Enter the Profit Margin:"); while (!Serial.available()) { // Wait for user input } profitMargin = Serial.parseFloat(); // Define scoring thresholds float peThresholdLow = 10.0; float peThresholdMedium = 15.0; float debtEquityThresholdLow = 0.5; float debtEquityThresholdMedium = 1.0; float profitMarginThresholdHigh = 15.0; float profitMarginThresholdMedium = 10.0; // Initialize scores int peScore = 0; int debtEquityScore = 0; int profitMarginScore = 0; // Scoring for P/E Ratio if (peRatio < peThresholdLow) { peScore = 3; } else if (peRatio < peThresholdMedium) { peScore = 2; } else { peScore = 1; } // Scoring for Debt to Equity Ratio if (debtToEquityRatio < debtEquityThresholdLow) { debtEquityScore = 3; } else if (debtToEquityRatio < debtEquityThresholdMedium) { debtEquityScore = 2; } else { debtEquityScore = 1; } // Scoring for Profit Margin if (profitMargin > profitMarginThresholdHigh) { profitMarginScore = 3; } else if (profitMargin > profitMarginThresholdMedium) { profitMarginScore = 2; } else { profitMarginScore = 1; } // Calculate overall stock score int overallScore = peScore + debtEquityScore + profitMarginScore; // Display individual scores and overall score Serial.println(" Individual Scores:"); Serial.print("P/E Ratio Score: "); Serial.println(peScore); Serial.print("Debt to Equity Ratio Score: "); Serial.println(debtEquityScore); Serial.print("Profit Margin Score: "); Serial.println(profitMarginScore); Serial.print(" Overall Stock Score: "); Serial.println(overallScore); // Wait for the next input delay(5000); }
Далее
Wait for it 😂
00:19
Просмотров 4,1 млн
Why did Raspberry Pi make their own SSD?
12:58
Просмотров 157 тыс.
E366 Navigating the Bible: Revelation
43:52
Просмотров 109 тыс.
6. Monte Carlo Simulation
50:05
Просмотров 2 млн
When do you use threads?
29:36
Просмотров 9 тыс.
Think Fast, Talk Smart: Communication Techniques
58:20