Alkimia API

alkquoteitem.cpp
1/*
2 SPDX-FileCopyrightText: 2011 Alvaro Soliverez asoliverez @kde.org
3
4 This file is part of libalkimia.
5
6 SPDX-License-Identifier: LGPL-2.1-or-later
7*/
8
9#include "alkquoteitem.h"
10
11class AlkQuoteItem::Private
12{
13public:
14 QString m_symbol;
15 QDateTime m_dateTime;
16 AlkValue m_currentValue;
17 AlkValue m_openingValue;
18 AlkValue m_highValue;
19 AlkValue m_lowValue;
20 AlkValue m_closingValue;
21 AlkValue m_volume;
22 AlkValue m_marketCap;
23 AlkValue m_changeToday;
24 AlkValue m_earnings;
25 AlkValue m_ebitda;
26 QString m_id;
27};
28
29AlkQuoteItem::AlkQuoteItem(QObject *parent)
30 : QObject(parent)
31 , d(new Private)
32{
33}
34
35AlkQuoteItem::~AlkQuoteItem()
36{
37}
38
39AlkQuoteItem::AlkQuoteItem(const AlkQuoteItem &item, QObject *parent)
40 : QObject(parent)
41 , d(new Private)
42{
43 setSymbol(item.symbol());
44 setDateTime(item.dateTime());
45 setCurrentValue(item.currentValue());
46 setOpeningValue(item.openingValue());
47 setHighValue(item.highValue());
48 setLowValue(item.lowValue());
49 setClosingValue(item.closingValue());
50 setVolume(item.volume());
51 setMarketCap(item.marketCap());
52 setEarningsPerShare(item.earningsPerShare());
53 setChangeToday(item.changeToday());
54 setEbitda(item.ebitda());
55 setRecordId(item.recordId());
56}
57
59{
60 return d->m_symbol;
61}
62
64{
65 return d->m_dateTime;
66}
67
68const AlkValue &AlkQuoteItem::currentValue() const
69{
70 return d->m_currentValue;
71}
72
73const AlkValue &AlkQuoteItem::openingValue() const
74{
75 return d->m_openingValue;
76}
77
78const AlkValue &AlkQuoteItem::highValue() const
79{
80 return d->m_highValue;
81}
82
83const AlkValue &AlkQuoteItem::lowValue() const
84{
85 return d->m_lowValue;
86}
87
88const AlkValue &AlkQuoteItem::closingValue() const
89{
90 return d->m_closingValue;
91}
92
93const AlkValue &AlkQuoteItem::volume() const
94{
95 return d->m_volume;
96}
97
98const AlkValue &AlkQuoteItem::marketCap() const
99{
100 return d->m_marketCap;
101}
102
103const AlkValue &AlkQuoteItem::earningsPerShare() const
104{
105 return d->m_earnings;
106}
107
108const AlkValue &AlkQuoteItem::changeToday() const
109{
110 return d->m_changeToday;
111}
112
113const AlkValue &AlkQuoteItem::ebitda() const
114{
115 return d->m_ebitda;
116}
117
119{
120 return d->m_id;
121}
122
123void AlkQuoteItem::setSymbol(const QString &symbol)
124{
125 d->m_symbol = symbol;
126}
127
128void AlkQuoteItem::setDateTime(const QDateTime &dateTime)
129{
130 d->m_dateTime = dateTime;
131}
132
133void AlkQuoteItem::setCurrentValue(const AlkValue &value)
134{
135 d->m_currentValue = value;
136}
137
138void AlkQuoteItem::setOpeningValue(const AlkValue &value)
139{
140 d->m_openingValue = value;
141}
142
143void AlkQuoteItem::setHighValue(const AlkValue &value)
144{
145 d->m_highValue = value;
146}
147
148void AlkQuoteItem::setLowValue(const AlkValue &value)
149{
150 d->m_lowValue = value;
151}
152
153void AlkQuoteItem::setClosingValue(const AlkValue &value)
154{
155 d->m_closingValue = value;
156}
157
158void AlkQuoteItem::setMarketCap(const AlkValue &value)
159{
160 d->m_marketCap = value;
161}
162
163void AlkQuoteItem::setVolume(const AlkValue &value)
164{
165 d->m_volume = value;
166}
167
168void AlkQuoteItem::setEarningsPerShare(const AlkValue &value)
169{
170 d->m_earnings = value;
171}
172
173void AlkQuoteItem::setChangeToday(const AlkValue &value)
174{
175 d->m_changeToday = value;
176}
177
178void AlkQuoteItem::setEbitda(const AlkValue &value)
179{
180 d->m_ebitda = value;
181}
182
183void AlkQuoteItem::setRecordId(const QString &recordId)
184{
185 d->m_id = recordId;
186}
187
188QDBusArgument &operator<<(QDBusArgument &argument, const AlkQuoteItem &item)
189{
190 argument.beginStructure();
191 argument << item.symbol() << item.dateTime().toString(Qt::ISODate)
192 << item.currentValue().toString()
193 << item.openingValue().toString()
194 << item.highValue().toString() << item.lowValue().toString()
195 << item.closingValue().toString()
196 << item.marketCap().toString() << item.volume().toString()
197 << item.earningsPerShare().toString()
198 << item.changeToday().toString() << item.ebitda().toString() << item.recordId();
199 argument.endStructure();
200 return argument;
201}
202
203const QDBusArgument &operator>>(const QDBusArgument &argument, AlkQuoteItem &item)
204{
205 argument.beginStructure();
206 QString symbol;
207 QString dateTime;
208 QString currentValue;
209 QString openingValue;
210 QString highValue;
211 QString lowValue;
212 QString closingValue;
213 QString marketCap;
215 QString earnings;
216 QString change;
217 QString ebitda;
218 QString recordId;
219
220 argument >> symbol >> dateTime >> currentValue >> openingValue >> highValue >> lowValue
221 >> closingValue >> marketCap >> volume >> earnings >> change >> ebitda >> recordId;
222 item.setSymbol(symbol);
223 item.setDateTime(QDateTime::fromString(dateTime, Qt::ISODate));
224 item.setCurrentValue(AlkValue(currentValue, '.'));
225 item.setOpeningValue(AlkValue(openingValue, '.'));
226 item.setHighValue(AlkValue(highValue, '.'));
227 item.setLowValue(AlkValue(lowValue, '.'));
228 item.setClosingValue(AlkValue(closingValue, '.'));
229 item.setMarketCap(AlkValue(marketCap, '.'));
230 item.setVolume(AlkValue(volume, '.'));
231 item.setEarningsPerShare(AlkValue(earnings, '.'));
232 item.setChangeToday(AlkValue(change, '.'));
233 item.setEbitda(AlkValue(ebitda, '.'));
234 item.setRecordId(recordId);
235
236 argument.endStructure();
237 return argument;
238}
This class represents a single quote of an equity It holds information of use to assess the equity va...
const AlkValue & highValue() const
Highest value of the share since the market opened that day.
const AlkValue & marketCap() const
Market capitalization.
const AlkValue & earningsPerShare() const
Earning per share.
const AlkValue & volume() const
Number of shares traded.
const QString & symbol() const
This is the symbol of the equity.
const QDateTime & dateTime() const
Date and time of the quote.
const AlkValue & changeToday() const
Today's change.
const QString & recordId() const
Internal id.
const AlkValue & ebitda() const
Earnings Before Interest, Taxes, Depreciation, and Amortization.
const AlkValue & closingValue() const
Value of the share when the market closed.
const AlkValue & lowValue() const
Lowest value of the share since the market opened that day.
const AlkValue & currentValue() const
Value of the share at the time of the quote.
const AlkValue & openingValue() const
Value of the share when the market opened.
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
QDebug operator<<(QDebug dbg, const DcrawInfoContainer &c)
void setVolume(qreal volume)
QDateTime fromString(QStringView string, QStringView format, QCalendar cal)
QString toString(QStringView format, QCalendar cal) const const
void beginStructure()
void endStructure()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.