[05.02.20] Addition of open price to model

This commit is contained in:
andyjk15 2020-02-05 22:32:01 +00:00
parent 434a6d1504
commit ce14d59ca1
4 changed files with 15 additions and 8 deletions

View File

@ -30,15 +30,18 @@ public class CryptoPriceModel {
@Column(name = "l_price", nullable = false)
private float low_price;
@Column(name = "o_price")
private float open_price;
@Column(name = "c_price")
private float close_price;
@Column(name = "volume")
private float volume;
// private transient String formattedDate;
//
// public String getFormattedDate() {
// return getTimestamp().toString();
// }
private transient String formattedDate;
public String getFormattedDate() {
return getTimestamp().toString();
}
}

View File

@ -14,8 +14,9 @@ public class BtcPriceMutation implements GraphQLMutationResolver {
private BtcPriceService btcPriceService;
public BtcPriceModel createBtc(final String createdDate, final String type, final float av_price,
final float h_price, final float l_price, final float c_price, final float volume ) {
return this.btcPriceService.createBtc(createdDate, type, av_price, h_price, l_price, c_price, volume);
final float h_price, final float l_price, final float o_price,
final float c_price, final float volume ) {
return this.btcPriceService.createBtc(createdDate, type, av_price, h_price, l_price, o_price, c_price, volume);
}
}

View File

@ -22,7 +22,8 @@ public class BtcPriceService {
@Transactional
public BtcPriceModel createBtc(final String createdDate, final String type, final float av_price,
final float h_price, final float l_price, final float c_price, final float volume ) {
final float h_price, final float l_price, final float o_price,
final float c_price, final float volume ) {
final BtcPriceModel btcPrice = new BtcPriceModel();
btcPrice.setTimestamp(format(createdDate).toString());
@ -30,6 +31,7 @@ public class BtcPriceService {
btcPrice.setAverage_price(av_price);
btcPrice.setHigh_price(h_price);
btcPrice.setLow_price(l_price);
btcPrice.setOpen_price(o_price);
btcPrice.setClose_price(c_price);
btcPrice.setVolume(volume);

View File

@ -5,6 +5,7 @@ type BtcPrice {
average_price: Float!,
high_price: Float,
low_price: Float,
open_price: Float,
close_price: Float,
volume: Float
}