def main(): # 객체1 s1 = Stock() # 객체1 설정 # 주식 종목 코드 : ABC # 주식 종목명 : DEF # 전일 가격 : 100 # 현재 가격 : 200 s1.setSymbol("INTC") s1.setName("Intel Corporation") s1.setPreviousClosingPrice(20500) s1.setCurrentPrice(20350) # 결과 출력 print("**** 객체1 ****") print("주식코드 :", s1.getSymbol()) print("주식명 :", s1.getName()) print("전일가격 :", s1.getPreviousClosingPrice()) print("현재가격 :", s1.getCurrentPrice()) print("변화비율 :", s1.getChangePercent())
def main(): stock1 = Stock('INTC', 'Intel Corporation', 20.5, 20.35) print(stock1.getName(), '公司的股票符号是:', stock1.getSymbol()) print(stock1.getName(), '前一天的股票收盘价格是:', stock1.getPreviousClosingPrice()) print(stock1.getName(), '当前的股票收盘价格是:', stock1.getCurrentPrice()) print(stock1.getName(), '今天收盘价与前一天收盘价变动了', stock1.getChagePercent())
from Stock import Stock google = Stock('TSLA') print("The current asking price for " + google.getTicker() + " is " + str(google.getCurrentPrice())) for i in range(100): print("The current asking price for " + google.getTicker() + " is " + str(google.getAllInfo()))
from Stock import Stock stock1 = Stock("INTC", "Intel Corporation", 20.50, 20.35) print("Stock name:", stock1.getName(), "Symbol:", stock1.getSymbol(), "previous closing price", stock1.getPreviousClosingPrice(), "current price:", stock1.getCurrentPrice(), "change Percent:", stock1.getChangePercent())