Compare commits
No commits in common. "master" and "1.0.0-b46" have entirely different histories.
17
pom.xml
17
pom.xml
@ -67,23 +67,6 @@
|
||||
<version>4.3.8.Final</version>
|
||||
</dependency>
|
||||
|
||||
<!-- GraghQL -->
|
||||
<dependency>
|
||||
<groupId>com.graphql-java</groupId>
|
||||
<artifactId>graphql-spring-boot-starter</artifactId>
|
||||
<version>5.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.graphql-java</groupId>
|
||||
<artifactId>graphql-java-tools</artifactId>
|
||||
<version>5.2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.graphql-java</groupId>
|
||||
<artifactId>graphiql-spring-boot-starter</artifactId>
|
||||
<version>5.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Artemis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
package cryptosky.me.pricing.graphql.queries;
|
||||
|
||||
import com.coxautodev.graphql.tools.GraphQLQueryResolver;
|
||||
import cryptosky.me.pricing.models.entities.BtcPriceModel;
|
||||
import cryptosky.me.pricing.service.PriceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Component
|
||||
public class BtcPriceQuery implements GraphQLQueryResolver {
|
||||
|
||||
@Autowired
|
||||
private PriceService priceService;
|
||||
|
||||
public List<BtcPriceModel> getAllPrices(final int count ) {
|
||||
return this.priceService.getAllPrices(count);
|
||||
}
|
||||
|
||||
public List<BtcPriceModel> getPricesBetweenCounts( final int startCount, final int endCount ) {
|
||||
return this.priceService.getPricesBetweenCounts(startCount, endCount);
|
||||
}
|
||||
|
||||
public Optional<BtcPriceModel> getLatest() {
|
||||
return this.priceService.getLatest();
|
||||
}
|
||||
|
||||
public Optional<BtcPriceModel> getPriceForCreatedDate( final String createdDate ) {
|
||||
return this.priceService.getPriceForCreatedDate(createdDate);
|
||||
}
|
||||
|
||||
public List<BtcPriceModel> getPriceBetweenDates(final String startDate, final String endDate ) {
|
||||
return this.priceService.getPriceBetweenDates(startDate, endDate);
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,7 @@ import cryptosky.me.pricing.models.entities.CryptoPriceModel;
|
||||
import cryptosky.me.pricing.models.repositories.BtcPriceRepository;
|
||||
|
||||
import cryptosky.me.exceptions.NotSupportedCurrencyTypeException;
|
||||
import cryptosky.me.exceptions.DatabaseViolationException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -21,9 +22,11 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.TextMessage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cryptosky.me.ArtemisSyncMessaging.*;
|
||||
import static cryptosky.me.SupportedCurrencies.*;
|
||||
@ -52,6 +55,29 @@ public class PriceService {
|
||||
this.dlqName = dlqName;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public BtcPriceModel createBtc(final String createdDate, final String type,
|
||||
final float av_price,
|
||||
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(LocalDateTime.parse((createdDate)));
|
||||
btcPrice.setType(type);
|
||||
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);
|
||||
|
||||
return btcPrice;
|
||||
// return this.btcPriceRepository.save(btcPrice);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void createRecord(CryptoPriceModel cryptoPriceModel, String correlationId, TextMessage message) {
|
||||
String syncId = randomUUID().toString();
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
type BtcPrice {
|
||||
id: ID!,
|
||||
timestamp: String!,
|
||||
type: String,
|
||||
average_price: Float!,
|
||||
high_price: Float,
|
||||
low_price: Float,
|
||||
open_price: Float,
|
||||
close_price: Float,
|
||||
volume: Float
|
||||
}
|
||||
|
||||
type sentimentModel {
|
||||
id: ID!,
|
||||
timestamp: String!,
|
||||
rawTweet: String,
|
||||
sentimentScore: Float!,
|
||||
positiveScore: Float,
|
||||
neutralScore: Float,
|
||||
negativeScore: Float,
|
||||
compoundScore: Float!
|
||||
}
|
||||
|
||||
type Query {
|
||||
allPrices(count: Int):[BtcPrice],
|
||||
pricesBetweenCounts(startCount: Int, endCount: Int):[BtcPrice]
|
||||
latest:BtcPrice,
|
||||
priceForCreatedDate(createdDate: String):BtcPrice,
|
||||
priceBetweenDates(startDate: String, endDate: String):[BtcPrice],
|
||||
################################################################
|
||||
currentTweet:sentimentModel,
|
||||
allTweets(count: Int):[sentimentModel],
|
||||
tweetsForDay(startDate: String, endDate: String):[sentimentModel],
|
||||
tweetsForPeriod(startDate: String, endDate: String):[sentimentModel]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user