StocQt
100개 종목을 위한 사용자 정의 가능한 주가 차트.

StocQt 애플리케이션은 나스닥 100(NASDAQ-100)을 기반으로 한 사용자 지정 100개 종목 목록에 대한 추세 차트를 제공합니다. 사용자는 목록에서 종목을 선택할 수 있습니다. 또한 이 애플리케이션에서는 비교 차트에 사용할 최대 5개의 종목을 즐겨찾기로 지정할 수 있습니다.
이 애플리케이션은 Search, StockCheckBox, StockChart, StockView, SettingsView와 같은 여러 사용자 정의 타입을 사용합니다. 이러한 타입들은 주식 데이터를 읽기 쉬운 형태로 표시하며, 사용자가 추세 차트를 맞춤 설정할 수 있게 해줍니다. 예를 들어, 사용자는 주가의 주간, 월간, 분기별 또는 반기별 추세를 확인하도록 선택할 수 있습니다.
이 애플리케이션은 API 요청 및 주식 즐겨찾기 설정과 같은 데이터 처리를 위해 C++로 구현된 사용자 정의 StockEngine 싱글톤을 사용합니다. 또한 온라인 데이터를 가져오기 위해 사용자 정의 APIHandler 클래스를 구현합니다.
void ApiHandler::stockHistory(const QString &symbol,
std::function<void(QList<HistoryData>)> onComplete)이 애플리케이션은 의존하는 시각적 데이터 모델에 접근하기 위해 ` ObjectModel ` 타입을 사용합니다.
id: mainWindow
...
ListView {
id: root
...
model: ObjectModel {
Item {
id: stockContainer
width: root.width
height: root.height
StockView {
id: stockView
anchors.fill: parent
visible: false
width: root.width
height: root.height
stateGroup: stateList
}
StockListView {
id: listView
visible: true
anchors.fill: parent
width: root.width
height: root.height
stateGroup: stateList
}
}
FavoriteView {
id: favoriteView
width: root.width
height: root.height
}
SettingsView {
id: infoView
width: root.width
height: root.height
}
}
}StockListModel은 주식 ID, 이름, 가격, 즐겨찾기 여부와 같은 기본 정보를 포함하여 주식을 나열하는 사용자 정의 데이터 모델입니다. 이 애플리케이션은 사용자가 목록에서 다른 주식을 선택하고자 할 때 이 데이터 모델을 사용합니다.
StockView와 FavoriteView는 선택된 주식 또는 최대 5개의 주식 그룹에 대한 추세 차트를 표시하는 복합 데이터 모델입니다. 이들 뷰는 StockEngine에서 데이터를 불러와 ListModel에 저장하고, Surface3D, Bars3D 또는 Scatter3D를 사용하여 주가의 추세를 그래픽으로 표시하는 또 다른 사용자 정의 유형인 StockChart 또는 FavoriteChart를 사용합니다.
Rectangle {
id: chart
...
function updateHistory(){
updateStartDate()
let startPoint = StockEngine.stockModel.indexOf(startDate)
let totalPoints = StockEngine.stockModel.historyCount()
let width = startPoint / 50
for (let i = 0; i < totalPoints; i++) {
let epochInDays = StockEngine.stockModel.historyDate(i, false) / 86400
appendSurfacePoint(openModel, width, epochInDays, StockEngine.stockModel.openPrice(i))
appendSurfacePoint(closeModel,width, epochInDays, StockEngine.stockModel.closePrice(i))
appendSurfacePoint(highModel,width, epochInDays, StockEngine.stockModel.highPrice(i))
appendSurfacePoint(lowModel,width, epochInDays, StockEngine.stockModel.lowPrice(i))
}
...
Surface3D {
id: historyGraph
...
Surface3DSeries {
id: highSeries
visible: true
baseColor: "green"
shading: Surface3DSeries.Shading.Flat
drawMode: Surface3DSeries.DrawSurface
itemLabelFormat: "Time: @xLabel High:@yLabel$"
ItemModelSurfaceDataProxy {
itemModel: highModel
rowRole: "row"
columnRole: "column"
yPosRole: "value"
}
},SettingsView는 애플리케이션에 대한 정보를 표시합니다.
애플리케이션을 더 잘 이해하려면 Qt Creator 또는 Visual Studio Code를 사용하여 코드를 살펴보세요.
예제 실행
다음 위치에서 예제를 실행할 수 있습니다.
- Qt Creator
Welcome 모드를 열고 Examples 에서 예제를 선택합니다. 자세한 내용은 Qt Creator: 튜토리얼: 빌드 및 실행을 참조하십시오.
- Qt Extension for Visual Studio Code
Command Palette 에서 Qt: Open Qt examples 명령을 실행하고 목록에서 예제를 선택합니다. 자세한 내용은 Qt Extension for Visual Studio Code: 튜토리얼: 빌드 및 실행을 참조하십시오.
QML 애플리케이션항목도 참조하십시오 .
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.