From 0e7fbf94084c3686e6a563783f1c3bd4109f9a9b Mon Sep 17 00:00:00 2001 From: Andy Sotheran Date: Mon, 3 Feb 2020 22:20:33 +0000 Subject: [PATCH] [03.02.20] Addition of Tweet handling and utility merging and alterations to timestamp handling --- .gitignore | 3 + pom.xml | 6 +- .../models/entities}/BtcPriceModel.java | 2 +- .../models/entities}/CryptoPriceModel.java | 8 +- .../repositories}/BtcPriceRepository.java | 4 +- .../mutations}/BtcPriceMutation.java | 6 +- .../queries}/BtcPriceQuery.java | 8 +- .../service/BtcPriceService.java | 21 ++-- .../tweets/models/entities/TweetModel.java | 44 ++++++++ .../models/repositories/TweetRepository.java | 9 ++ .../tweets/mutations/TweetMutation.java | 22 ++++ .../me/graphql/tweets/queries/TweetQuery.java | 33 ++++++ .../graphql/tweets/service/TweetService.java | 102 ++++++++++++++++++ src/main/java/cryptosky/me/helpers/Utils.java | 10 ++ src/main/resources/application.properties | 20 ++-- .../resources/graphql/btcPriceQL.graphqls | 22 ---- src/main/resources/graphql/configQL.graphqls | 40 +++++++ 17 files changed, 293 insertions(+), 67 deletions(-) rename src/main/java/cryptosky/me/graphql/{jpa/entity => pricing/models/entities}/BtcPriceModel.java (82%) rename src/main/java/cryptosky/me/graphql/{jpa/entity => pricing/models/entities}/CryptoPriceModel.java (84%) rename src/main/java/cryptosky/me/graphql/{jpa/repository => pricing/models/repositories}/BtcPriceRepository.java (62%) rename src/main/java/cryptosky/me/graphql/{mutation => pricing/mutations}/BtcPriceMutation.java (78%) rename src/main/java/cryptosky/me/graphql/{query => pricing/queries}/BtcPriceQuery.java (82%) rename src/main/java/cryptosky/me/graphql/{ => pricing}/service/BtcPriceService.java (85%) create mode 100644 src/main/java/cryptosky/me/graphql/tweets/models/entities/TweetModel.java create mode 100644 src/main/java/cryptosky/me/graphql/tweets/models/repositories/TweetRepository.java create mode 100644 src/main/java/cryptosky/me/graphql/tweets/mutations/TweetMutation.java create mode 100644 src/main/java/cryptosky/me/graphql/tweets/queries/TweetQuery.java create mode 100644 src/main/java/cryptosky/me/graphql/tweets/service/TweetService.java delete mode 100644 src/main/resources/graphql/btcPriceQL.graphqls create mode 100644 src/main/resources/graphql/configQL.graphqls diff --git a/.gitignore b/.gitignore index 1263624..d62a870 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,6 @@ build/ ### VS Code ### .vscode/ + +### Private DB properties file ### +*.properties \ No newline at end of file diff --git a/pom.xml b/pom.xml index 09730ba..217f25c 100644 --- a/pom.xml +++ b/pom.xml @@ -57,11 +57,6 @@ graphiql-spring-boot-starter 5.0.2 - - com.graphql-java - graphql-java-extended-scalars - 1.0 - @@ -82,6 +77,7 @@ 4.3.8.Final + org.projectlombok lombok diff --git a/src/main/java/cryptosky/me/graphql/jpa/entity/BtcPriceModel.java b/src/main/java/cryptosky/me/graphql/pricing/models/entities/BtcPriceModel.java similarity index 82% rename from src/main/java/cryptosky/me/graphql/jpa/entity/BtcPriceModel.java rename to src/main/java/cryptosky/me/graphql/pricing/models/entities/BtcPriceModel.java index abb1e27..d1c6d22 100644 --- a/src/main/java/cryptosky/me/graphql/jpa/entity/BtcPriceModel.java +++ b/src/main/java/cryptosky/me/graphql/pricing/models/entities/BtcPriceModel.java @@ -1,4 +1,4 @@ -package cryptosky.me.graphql.jpa.entity; +package cryptosky.me.graphql.pricing.models.entities; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/src/main/java/cryptosky/me/graphql/jpa/entity/CryptoPriceModel.java b/src/main/java/cryptosky/me/graphql/pricing/models/entities/CryptoPriceModel.java similarity index 84% rename from src/main/java/cryptosky/me/graphql/jpa/entity/CryptoPriceModel.java rename to src/main/java/cryptosky/me/graphql/pricing/models/entities/CryptoPriceModel.java index f843111..70a6477 100644 --- a/src/main/java/cryptosky/me/graphql/jpa/entity/CryptoPriceModel.java +++ b/src/main/java/cryptosky/me/graphql/pricing/models/entities/CryptoPriceModel.java @@ -1,9 +1,8 @@ -package cryptosky.me.graphql.jpa.entity; +package cryptosky.me.graphql.pricing.models.entities; import lombok.*; import javax.persistence.*; -import java.time.LocalDate; @AllArgsConstructor @NoArgsConstructor @@ -13,18 +12,15 @@ public class CryptoPriceModel { @Id @Column(name = "ID", nullable = false) - @GeneratedValue(strategy = GenerationType.TABLE) + @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; - @NonNull @Column(name = "timestamp", nullable = false) private String timestamp; - @NonNull @Column(name = "symbol", nullable = false) private String type; - @NonNull @Column(name = "av_price", nullable = false) private float average_price; diff --git a/src/main/java/cryptosky/me/graphql/jpa/repository/BtcPriceRepository.java b/src/main/java/cryptosky/me/graphql/pricing/models/repositories/BtcPriceRepository.java similarity index 62% rename from src/main/java/cryptosky/me/graphql/jpa/repository/BtcPriceRepository.java rename to src/main/java/cryptosky/me/graphql/pricing/models/repositories/BtcPriceRepository.java index fbd1092..7f6d05d 100644 --- a/src/main/java/cryptosky/me/graphql/jpa/repository/BtcPriceRepository.java +++ b/src/main/java/cryptosky/me/graphql/pricing/models/repositories/BtcPriceRepository.java @@ -1,6 +1,6 @@ -package cryptosky.me.graphql.jpa.repository; +package cryptosky.me.graphql.pricing.models.repositories; -import cryptosky.me.graphql.jpa.entity.BtcPriceModel; +import cryptosky.me.graphql.pricing.models.entities.BtcPriceModel; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/src/main/java/cryptosky/me/graphql/mutation/BtcPriceMutation.java b/src/main/java/cryptosky/me/graphql/pricing/mutations/BtcPriceMutation.java similarity index 78% rename from src/main/java/cryptosky/me/graphql/mutation/BtcPriceMutation.java rename to src/main/java/cryptosky/me/graphql/pricing/mutations/BtcPriceMutation.java index 811f670..f58f272 100644 --- a/src/main/java/cryptosky/me/graphql/mutation/BtcPriceMutation.java +++ b/src/main/java/cryptosky/me/graphql/pricing/mutations/BtcPriceMutation.java @@ -1,11 +1,11 @@ -package cryptosky.me.graphql.mutation; +package cryptosky.me.graphql.pricing.mutations; import com.coxautodev.graphql.tools.GraphQLMutationResolver; -import cryptosky.me.graphql.jpa.entity.BtcPriceModel; +import cryptosky.me.graphql.pricing.models.entities.BtcPriceModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import cryptosky.me.graphql.service.BtcPriceService; +import cryptosky.me.graphql.pricing.service.BtcPriceService; @Component public class BtcPriceMutation implements GraphQLMutationResolver { diff --git a/src/main/java/cryptosky/me/graphql/query/BtcPriceQuery.java b/src/main/java/cryptosky/me/graphql/pricing/queries/BtcPriceQuery.java similarity index 82% rename from src/main/java/cryptosky/me/graphql/query/BtcPriceQuery.java rename to src/main/java/cryptosky/me/graphql/pricing/queries/BtcPriceQuery.java index 972d852..8b55d18 100644 --- a/src/main/java/cryptosky/me/graphql/query/BtcPriceQuery.java +++ b/src/main/java/cryptosky/me/graphql/pricing/queries/BtcPriceQuery.java @@ -1,13 +1,11 @@ -package cryptosky.me.graphql.query; +package cryptosky.me.graphql.pricing.queries; import com.coxautodev.graphql.tools.GraphQLQueryResolver; -import cryptosky.me.graphql.jpa.entity.BtcPriceModel; -import cryptosky.me.graphql.jpa.entity.CryptoPriceModel; -import cryptosky.me.graphql.service.BtcPriceService; +import cryptosky.me.graphql.pricing.models.entities.BtcPriceModel; +import cryptosky.me.graphql.pricing.service.BtcPriceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.time.OffsetDateTime; import java.util.List; import java.util.Optional; diff --git a/src/main/java/cryptosky/me/graphql/service/BtcPriceService.java b/src/main/java/cryptosky/me/graphql/pricing/service/BtcPriceService.java similarity index 85% rename from src/main/java/cryptosky/me/graphql/service/BtcPriceService.java rename to src/main/java/cryptosky/me/graphql/pricing/service/BtcPriceService.java index 2027def..0988475 100644 --- a/src/main/java/cryptosky/me/graphql/service/BtcPriceService.java +++ b/src/main/java/cryptosky/me/graphql/pricing/service/BtcPriceService.java @@ -1,25 +1,21 @@ -package cryptosky.me.graphql.service; +package cryptosky.me.graphql.pricing.service; -import cryptosky.me.graphql.jpa.entity.BtcPriceModel; -import cryptosky.me.graphql.jpa.repository.BtcPriceRepository; +import cryptosky.me.graphql.pricing.models.entities.BtcPriceModel; +import cryptosky.me.graphql.pricing.models.repositories.BtcPriceRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; -import static cryptosky.me.helpers.Utils.distinctByKey; +import static cryptosky.me.helpers.Utils.format; @Service public class BtcPriceService { private final BtcPriceRepository btcPriceRepository; - DateTimeFormatter format = DateTimeFormatter.ISO_DATE_TIME;//ofPattern("dd-MM-yy HH:mm"); - public BtcPriceService(final BtcPriceRepository btcPriceRepository) { this.btcPriceRepository = btcPriceRepository; } @@ -29,7 +25,7 @@ public class BtcPriceService { final float h_price, final float l_price, final float c_price, final float volume ) { final BtcPriceModel btcPrice = new BtcPriceModel(); - btcPrice.setTimestamp(LocalDate.parse(createdDate, format).toString()); + btcPrice.setTimestamp(format(createdDate).toString()); btcPrice.setType(type); btcPrice.setAverage_price(av_price); btcPrice.setHigh_price(h_price); @@ -37,7 +33,6 @@ public class BtcPriceService { btcPrice.setClose_price(c_price); btcPrice.setVolume(volume); - return this.btcPriceRepository.save(btcPrice); } @@ -64,15 +59,15 @@ public class BtcPriceService { @Transactional(readOnly = true) public Optional getPriceForCreatedDate( final String createdDate ) { return this.btcPriceRepository.findAll().stream() - .filter(createdDateList -> createdDateList.getTimestamp().equals(LocalDate.parse(createdDate, format))) + .filter(createdDateList -> createdDateList.getTimestamp().equals(format(createdDate))) .findFirst(); } @Transactional(readOnly = true) public List getPriceBetweenDates( final String startDate, final String endDate ) { return this.btcPriceRepository.findAll().stream() - .filter(createdDateList -> LocalDate.parse(createdDateList.getTimestamp(), format).isBefore(LocalDate.parse(endDate, format))) - .filter(createdDateList -> LocalDate.parse(createdDateList.getTimestamp(), format).isAfter(LocalDate.parse(startDate, format))) + .filter(createdDateList -> format(createdDateList.getTimestamp()).isBefore(format(endDate))) + .filter(createdDateList -> format(createdDateList.getTimestamp()).isAfter(format(startDate))) .collect(Collectors.toList()); } diff --git a/src/main/java/cryptosky/me/graphql/tweets/models/entities/TweetModel.java b/src/main/java/cryptosky/me/graphql/tweets/models/entities/TweetModel.java new file mode 100644 index 0000000..ed2934b --- /dev/null +++ b/src/main/java/cryptosky/me/graphql/tweets/models/entities/TweetModel.java @@ -0,0 +1,44 @@ +package cryptosky.me.graphql.tweets.models.entities; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.persistence.*; + +@AllArgsConstructor +@NoArgsConstructor +@Data +@Builder +@Table(name = "tweet_data") +@Entity +public class TweetModel { + + @Id + @Column(name = "ID", nullable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int id; + + @Column(name = "timestamp",nullable = false) + private String timestamp; + + @Column(name = "raw_tweet", nullable = false) + private String rawTweet; + + @Column(name = "sentiment") + private float sentimentScore; + + @Column(name = "pos") + private float positiveScore; + + @Column(name = "neu") + private float neutralScore; + + @Column(name = "neg") + private float negativeScore; + + @Column(name = "compound", nullable = false) + private float compoundScore; + +} diff --git a/src/main/java/cryptosky/me/graphql/tweets/models/repositories/TweetRepository.java b/src/main/java/cryptosky/me/graphql/tweets/models/repositories/TweetRepository.java new file mode 100644 index 0000000..d15f861 --- /dev/null +++ b/src/main/java/cryptosky/me/graphql/tweets/models/repositories/TweetRepository.java @@ -0,0 +1,9 @@ +package cryptosky.me.graphql.tweets.models.repositories; + +import cryptosky.me.graphql.tweets.models.entities.TweetModel; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface TweetRepository extends JpaRepository { +} diff --git a/src/main/java/cryptosky/me/graphql/tweets/mutations/TweetMutation.java b/src/main/java/cryptosky/me/graphql/tweets/mutations/TweetMutation.java new file mode 100644 index 0000000..1cde3d3 --- /dev/null +++ b/src/main/java/cryptosky/me/graphql/tweets/mutations/TweetMutation.java @@ -0,0 +1,22 @@ +package cryptosky.me.graphql.tweets.mutations; + +import com.coxautodev.graphql.tools.GraphQLMutationResolver; +import cryptosky.me.graphql.tweets.models.entities.TweetModel; +import cryptosky.me.graphql.tweets.service.TweetService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class TweetMutation implements GraphQLMutationResolver { + + @Autowired + TweetService tweetService; + + public TweetModel createTweet( final String createdDate, final String rawTweet, final float sentimentScore, + final float positiveScore, final float neutralScore, final float negativeScore, + final float compoundScore ) { + return this.tweetService.createTweet( createdDate, rawTweet, sentimentScore, positiveScore, neutralScore, + negativeScore,compoundScore ); + } + +} diff --git a/src/main/java/cryptosky/me/graphql/tweets/queries/TweetQuery.java b/src/main/java/cryptosky/me/graphql/tweets/queries/TweetQuery.java new file mode 100644 index 0000000..1152fdb --- /dev/null +++ b/src/main/java/cryptosky/me/graphql/tweets/queries/TweetQuery.java @@ -0,0 +1,33 @@ +package cryptosky.me.graphql.tweets.queries; + +import com.coxautodev.graphql.tools.GraphQLQueryResolver; +import cryptosky.me.graphql.tweets.models.entities.TweetModel; +import cryptosky.me.graphql.tweets.service.TweetService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Optional; + +@Component +public class TweetQuery implements GraphQLQueryResolver { + + @Autowired + private TweetService tweetService; + + public Optional getCurrentTweet() { + return this.tweetService.getCurrentTweet(); + } + + public List getAllTweets( final int count ) { + return this.tweetService.getAllTweets(count); + } + + public List getTweetsForDay( final String startDate, final String endDate ) { + return this.tweetService.getTweetsForDay(startDate, endDate); + } + + public List getTweetsForPeriod( final String startDate, final String endDate ) { + return this.tweetService.getTweetsForPeriod( startDate, endDate ); + } +} diff --git a/src/main/java/cryptosky/me/graphql/tweets/service/TweetService.java b/src/main/java/cryptosky/me/graphql/tweets/service/TweetService.java new file mode 100644 index 0000000..b2b6de0 --- /dev/null +++ b/src/main/java/cryptosky/me/graphql/tweets/service/TweetService.java @@ -0,0 +1,102 @@ +package cryptosky.me.graphql.tweets.service; + +import cryptosky.me.graphql.tweets.models.entities.TweetModel; +import cryptosky.me.graphql.tweets.models.repositories.TweetRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.DateTimeException; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import static cryptosky.me.helpers.Utils.format; + +@Service +public class TweetService { + + private final TweetRepository tweetRepository; + + public TweetService( final TweetRepository tweetRepository ) { + this.tweetRepository = tweetRepository; + } + + @Transactional + public TweetModel createTweet( final String createdDate, final String rawTweet, final float sentimentScore, + final float positiveScore, final float neutralScore, final float negativeScore, + final float compoundScore ) { + + final TweetModel tweetModel = TweetModel.builder() + .timestamp(format(createdDate).toString()) + .rawTweet(rawTweet) + .sentimentScore(sentimentScore) + .positiveScore(positiveScore) + .negativeScore(negativeScore) + .neutralScore(neutralScore) + .compoundScore(compoundScore) + .build(); + + return this.tweetRepository.save(tweetModel); + } + + @Transactional(readOnly = true) + public Optional getCurrentTweet() { + return this.tweetRepository.findAll().stream().findFirst(); + } + + @Transactional(readOnly = true) + public List getAllTweets( final int count ) { + return this.tweetRepository.findAll().stream() + .limit(count) + .collect(Collectors.toList()); + } + + @Transactional(readOnly = true) + public List getTweetsForDay( final String startDate, final String endDate ) { + LocalDateTime r_start = format(startDate); + LocalDateTime r_end = format(endDate); + + r_start = r_start.toLocalDate().atStartOfDay(); + r_end = r_end.toLocalDate().atTime(LocalTime.MAX); + + if ( r_end.isAfter(r_start) ) { + if ( r_end.equals(r_start.toLocalDate().atTime(LocalTime.MAX))) { + LocalDateTime finalR_end = r_end; + LocalDateTime finalR_start = r_start; + return this.tweetRepository.findAll().stream() + .filter(createdDateList -> format(createdDateList.getTimestamp()).isBefore(finalR_end)) + .filter(createdDateList -> format(createdDateList.getTimestamp()).isAfter(finalR_start)) + .collect(Collectors.toList()); + } else { + // Logger + throw new DateTimeException(r_start +" and "+ r_end +" are not on the same day"); + } + } else { + // Logger + throw new DateTimeException("End Date "+ r_end +" is not after "+ r_start); + } + } + + @Transactional(readOnly = true) + public List getTweetsForPeriod( final String startDate, final String endDate ) { + LocalDateTime r_start = format(startDate); + LocalDateTime r_end = format(endDate); + + r_start = r_start.toLocalDate().atStartOfDay(); + r_end = r_end.toLocalDate().atTime(LocalTime.MAX); + + if ( r_end.isAfter(r_start) ) { + LocalDateTime finalR_end = r_end; + LocalDateTime finalR_start = r_start; + return this.tweetRepository.findAll().stream() + .filter(createdDateList -> format(createdDateList.getTimestamp()).isBefore(finalR_end)) + .filter(createdDateList -> format(createdDateList.getTimestamp()).isAfter(finalR_start)) + .collect(Collectors.toList()); + } else { + // Logger + throw new DateTimeException("End Date "+ r_end +" is not after "+ r_start); + } + } +} diff --git a/src/main/java/cryptosky/me/helpers/Utils.java b/src/main/java/cryptosky/me/helpers/Utils.java index 5341c4e..8f31195 100644 --- a/src/main/java/cryptosky/me/helpers/Utils.java +++ b/src/main/java/cryptosky/me/helpers/Utils.java @@ -1,5 +1,9 @@ package cryptosky.me.helpers; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @@ -12,4 +16,10 @@ public class Utils { Map seen = new ConcurrentHashMap<>(); return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; } + + public static LocalDateTime format(String T) { + DateTimeFormatter F = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX") + .withZone(ZoneId.of("UTC")); + return LocalDateTime.parse(T, F); + } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c5787cb..855cb24 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,10 +1,10 @@ -#server.port=9090 -##spring.jpa.database=POSTGRESQL -##spring.datasource.platform=postgres -##spring.datasource.url=jdbc:postgresql://localhost:5432/postgres -##spring.datasource.username=postgres -##spring.datasource.password=***** -##spring.jpa.show-sql=true -##spring.jpa.generate-ddl=true -##spring.jpa.hibernate.ddl-auto=create-drop -##spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true \ No newline at end of file +server.port=9090 +spring.jpa.database=POSTGRESQL +spring.datasource.platform=postgres +spring.datasource.url=jdbc:postgresql://localhost:5432/postgres +spring.datasource.username=postgres +spring.datasource.password=***** +spring.jpa.show-sql=true +spring.jpa.generate-ddl=true +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true \ No newline at end of file diff --git a/src/main/resources/graphql/btcPriceQL.graphqls b/src/main/resources/graphql/btcPriceQL.graphqls deleted file mode 100644 index 417269b..0000000 --- a/src/main/resources/graphql/btcPriceQL.graphqls +++ /dev/null @@ -1,22 +0,0 @@ -type BtcPrice { - id: ID!, - timestamp: String!, - type: String, - average_price: Float!, - high_price: Float, - low_price: Float, - close_price: Float, - volume: 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] -} - -type Mutation { - createBtc(createdDate: String!, type: String!, average_price: Float!, high_price: Float, low_price: Float, close_price: Float, volume: Float):BtcPrice -} \ No newline at end of file diff --git a/src/main/resources/graphql/configQL.graphqls b/src/main/resources/graphql/configQL.graphqls new file mode 100644 index 0000000..d21e918 --- /dev/null +++ b/src/main/resources/graphql/configQL.graphqls @@ -0,0 +1,40 @@ +type BtcPrice { + id: ID!, + timestamp: String!, + type: String, + average_price: Float!, + high_price: Float, + low_price: Float, + close_price: Float, + volume: Float +} + +type tweetModel { + 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:tweetModel, + allTweets(count: Int):[tweetModel], + tweetsForDay(startDate: String, endDate: String):[tweetModel], + tweetsForPeriod(startDate: String, endDate: String):[tweetModel] +} + +type Mutation { + createBtc(createdDate: String!, type: String!, average_price: Float!, high_price: Float, low_price: Float, close_price: Float, volume: Float):BtcPrice + createTweet(createdDate: String!, rawTweet: String!, sentimentScore: Float!, positiveScore: Float, neutralScore: Float, negativeScore: Float, compoundScore: Float!):tweetModel + +} \ No newline at end of file