mirror of
https://gitlab.com/simple-stock-bots/simple-stock-bot.git
synced 2026-06-03 21:00:26 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 29240b99ac | |||
| 4abe4fedcc | |||
| 5b12ed1ce4 | |||
| c6a0320563 | |||
| bca9b3e111 | |||
| cedacc5749 | |||
| b72f0518c2 | |||
| bc1ad95c75 | |||
| 7966871869 |
+2
-2
@@ -16,7 +16,7 @@ build:master:
|
|||||||
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
|
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
|
||||||
--destination "${CI_REGISTRY_IMAGE}:latest"
|
--destination "${CI_REGISTRY_IMAGE}:latest"
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
|
||||||
|
|
||||||
|
|
||||||
build:branch:
|
build:branch:
|
||||||
@@ -31,4 +31,4 @@ build:branch:
|
|||||||
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}"
|
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}"
|
||||||
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_BRANCH}"
|
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_BRANCH}"
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME != "master"'
|
||||||
+1
-12
@@ -101,19 +101,8 @@ class MarketData:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if quoteResp := self.get(f"stocks/quotes/{symbol}/"):
|
if quoteResp := self.get(f"stocks/quotes/{symbol}/"):
|
||||||
price = round(quoteResp["last"][0], 2)
|
return f"The current price of {quoteResp['symbol']} is ${quoteResp['last']}"
|
||||||
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:
|
else:
|
||||||
return f"Getting a quote for {symbol} encountered an error."
|
return f"Getting a quote for {symbol} encountered an error."
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ class Stock(Symbol):
|
|||||||
def __init__(self, symbol: str) -> None:
|
def __init__(self, symbol: str) -> None:
|
||||||
self.symbol = symbol
|
self.symbol = symbol
|
||||||
self.id = symbol
|
self.id = symbol
|
||||||
self.name = "$" + symbol.upper()
|
self.name = "$" + symbol
|
||||||
self.tag = "$" + symbol.lower()
|
self.tag = "$" + symbol.upper()
|
||||||
|
|
||||||
|
|
||||||
class Coin(Symbol):
|
class Coin(Symbol):
|
||||||
|
|||||||
Reference in New Issue
Block a user