1
0
mirror of https://gitlab.com/simple-stock-bots/simple-stock-bot.git synced 2026-06-03 21:00:26 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Anson 99a3c8633a implement MR 2023-04-08 18:40:18 -06:00
Anson e63dc7f46b Update .gitlab-ci.yml file 2023-04-07 20:51:14 +00:00
Anson 928a23c8c6 fighting CI 2023-04-07 14:50:29 -06:00
Anson 580fcbb84d Merge branch '88-switch-to-marketdata-app-for-stock-market-data' into 'master'
Resolve "Switch to marketdata.app for stock market data"

Closes #88

See merge request simple-stock-bots/simple-telegram-stock-bot!40
2023-04-07 20:46:23 +00:00
Anson 322dffa2f2 Resolve "Switch to marketdata.app for stock market data" 2023-04-07 20:46:23 +00:00
3 changed files with 18 additions and 5 deletions
+4 -2
View File
@@ -16,10 +16,10 @@ build:master:
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:latest"
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
- if: '$CI_COMMIT_BRANCH == "master"'
build:master:
build:branch:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.9.0-debug
@@ -30,3 +30,5 @@ build:master:
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}"
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_BRANCH}"
rules:
- if: '$CI_COMMIT_BRANCH != "master"'
+12 -1
View File
@@ -101,8 +101,19 @@ class MarketData:
"""
if quoteResp := self.get(f"stocks/quotes/{symbol}/"):
return f"The current price of {quoteResp['symbol']} is ${quoteResp['last']}"
price = round(quoteResp["last"][0], 2)
changePercent = round(quoteResp["changepct"][0], 2)
message = f"The current price of {symbol.name} is ${price} and "
if changePercent > 0.0:
message += f"is currently up {changePercent}% for the day."
elif changePercent < 0.0:
message += f"is currently down {changePercent}% for the day."
else:
message += "hasn't shown any movement for the day."
return message
else:
return f"Getting a quote for {symbol} encountered an error."
+2 -2
View File
@@ -32,8 +32,8 @@ class Stock(Symbol):
def __init__(self, symbol: str) -> None:
self.symbol = symbol
self.id = symbol
self.name = "$" + symbol
self.tag = "$" + symbol.upper()
self.name = "$" + symbol.upper()
self.tag = "$" + symbol.lower()
class Coin(Symbol):