Write top30 at specific file path
This commit is contained in:
@@ -15,8 +15,13 @@ extension KissConsole {
|
||||
URL.currentDirectory().appending(path: "data/shop-products.csv")
|
||||
}
|
||||
|
||||
static func topProductsUrl(_ belong: BelongClassCode) -> URL {
|
||||
URL.currentDirectory().appending(path: "data/top-\(belong.fileBelong).csv")
|
||||
static func topProductsUrl(_ belong: BelongClassCode, date: Date) -> URL {
|
||||
let subPath = "data/top30/\(date.yyyyMMdd)"
|
||||
let subFile = "\(subPath)/top30-\(belong.fileBelong)-\(date.yyyyMMdd)-\(date.HHmmss).csv"
|
||||
|
||||
let fileUrl = URL.currentDirectory().appending(path: subFile)
|
||||
createSubpath(subPath)
|
||||
return fileUrl
|
||||
}
|
||||
|
||||
static var accountStocksUrl: URL {
|
||||
|
||||
@@ -383,6 +383,7 @@ extension KissConsole {
|
||||
let option = RankingOption(divisionClass: .all, belongClass: belongClass)
|
||||
|
||||
do {
|
||||
let curDate = Date()
|
||||
let rank = try await account!.getVolumeRanking(option: option)
|
||||
guard let output = rank.output else {
|
||||
print("Error \(rank.messageCode) \(rank.message)")
|
||||
@@ -393,7 +394,7 @@ extension KissConsole {
|
||||
for item in output {
|
||||
print("\(item.dataRank) \(item.shortProductNo) \(item.htsProductName.maxSpace(20)) \(item.currentStockPrice.maxSpace(10, digitBy: 3)) \(item.averageVolume.maxSpace(15, digitBy: 3)) \(item.accumulatedTradingAmount.maxSpace(25, digitBy: 3))")
|
||||
}
|
||||
let fileUrl = KissConsole.topProductsUrl(belongClass)
|
||||
let fileUrl = KissConsole.topProductsUrl(belongClass, date: curDate)
|
||||
try output.writeCsv(toFile: fileUrl, localized: localized)
|
||||
print("wrote \(fileUrl.lastPathComponent) with \(output.count)")
|
||||
} catch {
|
||||
|
||||
@@ -17,7 +17,7 @@ command | 설명
|
||||
`login mock` | Mock 서버로 로그인. mock-server.json 을 credential 로 사용.
|
||||
`login real` | Real 서버로 로그인. real-server.json 을 credential 로 사용.
|
||||
`logout` | 접속한 서버에서 로그아웃.
|
||||
`top (0,1,2,3,4)` | 상위 거래량 30종목 (0:평균거래량, 1:거래증가율, 2:평균거래회전율, 3:거래금액순, 4:평균거래금액회전율). **data/top30/(yyyy)/top30-(BELONG)-(yyyyMMdd).csv** 파일로 저장.
|
||||
`top (0,1,2,3,4)` | 상위 거래량 30종목 (0:평균거래량, 1:거래증가율, 2:평균거래회전율, 3:거래금액순, 4:평균거래금액회전율). **data/top30/(yyyyMMdd)/top30-(BELONG)-(yyyyMMdd)-(HHmmss).csv** 파일로 저장.
|
||||
`buy (PNO) (가격) (수량)` | 상품을 구매. (가격) 에 -8282 로 입력하면 시장가격. (수량) 에 -82 로 입력하면 최대수량.
|
||||
`buy check (PNO) (가격)` | 현재 잔고로 구매가 가능한 수량을 확인.
|
||||
`sell (PNO) (가격) (수량)` | 보유한 상품을 판매. (가격) 에 -8282 로 입력하면 시장가격.
|
||||
|
||||
Reference in New Issue
Block a user