Move away from Python Interop for better stability
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
import sys
|
||||
import yfinance as yf
|
||||
|
||||
def getCurrentPrice(symbol):
|
||||
def getCurrentPrice():
|
||||
|
||||
# Get the Symbol from ARGV
|
||||
symbol = sys.argv[1]
|
||||
|
||||
ticker = yf.Ticker(symbol)
|
||||
data = ticker.history(period="1d", interval="1m")
|
||||
current_price = data['Close'].iloc[-1]
|
||||
return current_price
|
||||
|
||||
# Return to C# via stdout
|
||||
print(f"---RESULT_START---")
|
||||
print(current_price)
|
||||
print(f"---RESULT_END---")
|
||||
|
||||
if __name__ == "__main__":
|
||||
getCurrentPrice()
|
||||
Reference in New Issue
Block a user