1
0
mirror of https://gitlab.com/simple-stock-bots/simple-stock-bot.git synced 2026-06-04 05:10:25 +00:00

Compare commits

..

9 Commits

Author SHA1 Message Date
Anson 29240b99ac Merge branch 'master' into '88-switch-to-marketdata-app-for-stock-market-data'
# Conflicts:
#   .gitlab-ci.yml
2023-04-07 20:44:47 +00:00
Anson 4abe4fedcc try again 2023-04-07 14:43:43 -06:00
Anson 5b12ed1ce4 small CI change 2023-04-07 14:37:13 -06:00
Anson c6a0320563 round 2 2023-04-07 14:33:27 -06:00
Anson bca9b3e111 time to fight the CI 2023-04-07 14:17:47 -06:00
Anson cedacc5749 small code clean up and add linting to repo 2023-04-07 00:15:01 -06:00
Anson b72f0518c2 get bot working with marketdata api 2023-04-06 23:27:02 -06:00
Anson bc1ad95c75 apply black formatting to previous commit 2023-04-06 17:15:04 -06:00
Anson 7966871869 original progress from a few weekends ago 2023-04-06 16:17:05 -06:00
3 changed files with 5 additions and 16 deletions
+2 -2
View File
@@ -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
View File
@@ -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."
+2 -2
View File
@@ -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):