├── .github └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── .mvn └── wrapper │ ├── MavenWrapperDownloader.java │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .project ├── .settings ├── org.eclipse.core.resources.prefs └── org.eclipse.m2e.core.prefs ├── .travis.yml ├── Dockerfile ├── LICENSE.md ├── README.md ├── backend ├── .classpath ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.m2e.core.prefs ├── pom.xml └── src │ ├── main │ ├── java │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ ├── ch │ │ │ └── xxx │ │ │ │ └── trader │ │ │ │ ├── TraderApplication.java │ │ │ │ ├── adapter │ │ │ │ ├── clients │ │ │ │ │ ├── MongoDbClient.java │ │ │ │ │ ├── MongoDbConfiguration.java │ │ │ │ │ ├── RestOrderBookClient.java │ │ │ │ │ └── test │ │ │ │ │ │ ├── RestClientBitfinex.java │ │ │ │ │ │ ├── RestClientBitstamp.java │ │ │ │ │ │ ├── RestClientCoinbase.java │ │ │ │ │ │ ├── RestClientItbit.java │ │ │ │ │ │ ├── WebsocketClient.java │ │ │ │ │ │ └── WsClient.java │ │ │ │ ├── config │ │ │ │ │ ├── ApplicationConfig.java │ │ │ │ │ ├── ExceptionLoggingFilter.java │ │ │ │ │ ├── FlapDoodleConfig.java │ │ │ │ │ ├── ForwardServletFilter.java │ │ │ │ │ ├── GlobalExceptionHandler.java │ │ │ │ │ ├── JwtTokenFilter.java │ │ │ │ │ ├── KafkaConfig.java │ │ │ │ │ ├── SchedulingConfig.java │ │ │ │ │ ├── SpringMongoConfig.java │ │ │ │ │ └── WebSecurityConfig.java │ │ │ │ ├── controller │ │ │ │ │ ├── BitfinexController.java │ │ │ │ │ ├── BitstampController.java │ │ │ │ │ ├── CoinbaseController.java │ │ │ │ │ ├── ItbitController.java │ │ │ │ │ ├── MyUserController.java │ │ │ │ │ └── StatisticsController.java │ │ │ │ ├── cron │ │ │ │ │ ├── PrepareDataTask.java │ │ │ │ │ ├── ScheduledTask.java │ │ │ │ │ └── TaskStarter.java │ │ │ │ ├── events │ │ │ │ │ ├── EventConsumer.java │ │ │ │ │ ├── EventProducer.java │ │ │ │ │ └── KafkaStreams.java │ │ │ │ └── repository │ │ │ │ │ └── ClientMongoRepository.java │ │ │ │ ├── domain │ │ │ │ ├── common │ │ │ │ │ ├── JwtUtils.java │ │ │ │ │ ├── MongoUtils.java │ │ │ │ │ ├── PasswordEncryption.java │ │ │ │ │ ├── Role.java │ │ │ │ │ ├── StreamHelpers.java │ │ │ │ │ └── WebUtils.java │ │ │ │ ├── exceptions │ │ │ │ │ ├── AuthenticationException.java │ │ │ │ │ ├── JwtTokenValidationException.java │ │ │ │ │ └── MyErrorAttributes.java │ │ │ │ ├── model │ │ │ │ │ ├── dto │ │ │ │ │ │ ├── AuthCheck.java │ │ │ │ │ │ ├── CommonStatisticsDto.java │ │ │ │ │ │ ├── CurrencyCb.java │ │ │ │ │ │ ├── QuotePdf.java │ │ │ │ │ │ ├── RangeDto.java │ │ │ │ │ │ ├── RefreshTokenDto.java │ │ │ │ │ │ ├── RevokedTokensDto.java │ │ │ │ │ │ ├── StatisticsCommon.java │ │ │ │ │ │ └── WrapperCb.java │ │ │ │ │ └── entity │ │ │ │ │ │ ├── MyMongoRepository.java │ │ │ │ │ │ ├── MyUser.java │ │ │ │ │ │ ├── Quote.java │ │ │ │ │ │ ├── QuoteBf.java │ │ │ │ │ │ ├── QuoteBs.java │ │ │ │ │ │ ├── QuoteCb.java │ │ │ │ │ │ ├── QuoteCbSmall.java │ │ │ │ │ │ ├── QuoteIb.java │ │ │ │ │ │ ├── RevokedToken.java │ │ │ │ │ │ └── paxos │ │ │ │ │ │ ├── PaxosDay.java │ │ │ │ │ │ ├── PaxosPrice.java │ │ │ │ │ │ ├── PaxosQuote.java │ │ │ │ │ │ └── PaxosTimeRange.java │ │ │ │ └── services │ │ │ │ │ ├── MyEventProducer.java │ │ │ │ │ ├── MyOrderBookClient.java │ │ │ │ │ └── MyUserService.java │ │ │ │ └── usecase │ │ │ │ ├── common │ │ │ │ ├── DtoUtils.java │ │ │ │ └── LastlogoutTimestampExtractor.java │ │ │ │ ├── mappers │ │ │ │ ├── EventMapper.java │ │ │ │ └── ReportMapper.java │ │ │ │ └── services │ │ │ │ ├── BitfinexService.java │ │ │ │ ├── BitstampService.java │ │ │ │ ├── CoinbaseService.java │ │ │ │ ├── ItbitService.java │ │ │ │ ├── JwtTokenService.java │ │ │ │ ├── MyAuthenticationProvider.java │ │ │ │ ├── MyUserServiceBean.java │ │ │ │ ├── MyUserServiceDb.java │ │ │ │ ├── MyUserServiceEvents.java │ │ │ │ ├── ReportGenerator.java │ │ │ │ ├── ServiceUtils.java │ │ │ │ └── StatisticService.java │ │ └── org │ │ │ └── apache │ │ │ └── kafka │ │ │ └── clients │ │ │ └── DefaultHostResolver.java │ └── resources │ │ ├── .gitignore │ │ ├── application-kafka.properties │ │ ├── application-prod.properties │ │ ├── application.properties │ │ ├── currencyReport.jrxml │ │ └── log4j.xml │ └── test │ ├── java │ └── ch │ │ └── xxx │ │ └── trader │ │ ├── PasswordEncryptionTest.java │ │ ├── RandomNumberTest.java │ │ ├── TraderApplicationTests.java │ │ ├── adapter │ │ ├── controller │ │ │ ├── BaseControllerTest.java │ │ │ └── MyUserControllerTest.java │ │ ├── cron │ │ │ └── ScheduledTaskTest.java │ │ └── repository │ │ │ └── ClientMongoRepositoryTest.java │ │ ├── architecture │ │ ├── MyArchitectureTests.java │ │ └── PatternTest.java │ │ └── usecase │ │ └── services │ │ ├── MyUserServiceTest.java │ │ └── StatisticServiceTest.java │ └── resources │ └── application.properties ├── buildDocker.sh ├── frontend ├── .classpath ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.m2e.core.prefs ├── pom.xml └── src │ └── angular │ ├── .editorconfig │ ├── .eslintrc.json │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── base │ └── index.html │ ├── browserslist │ ├── e2e │ ├── src │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.e2e.json │ ├── i18n │ └── messages.de.json │ ├── karma.conf.js │ ├── package-lock.json │ ├── package.json │ ├── proxy.conf.js │ ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── common │ │ │ ├── authcheck.ts │ │ │ ├── common-statistics.ts │ │ │ ├── common-utils.ts │ │ │ ├── detail-base.ts │ │ │ ├── my-user.ts │ │ │ ├── orderbook-bf.ts │ │ │ ├── orderbook-bs.ts │ │ │ ├── orderbook-ib.ts │ │ │ ├── quote-bf.ts │ │ │ ├── quote-bs.ts │ │ │ ├── quote-cb.ts │ │ │ └── quote-ib.ts │ │ ├── details │ │ │ ├── bfdetail │ │ │ │ ├── bfdetail.component.html │ │ │ │ ├── bfdetail.component.scss │ │ │ │ ├── bfdetail.component.spec.ts │ │ │ │ └── bfdetail.component.ts │ │ │ ├── bsdetail │ │ │ │ ├── bsdetail.component.html │ │ │ │ ├── bsdetail.component.scss │ │ │ │ ├── bsdetail.component.spec.ts │ │ │ │ └── bsdetail.component.ts │ │ │ ├── cbdetail │ │ │ │ ├── cbdetail.component.html │ │ │ │ ├── cbdetail.component.scss │ │ │ │ ├── cbdetail.component.spec.ts │ │ │ │ └── cbdetail.component.ts │ │ │ ├── details-routing.module.ts │ │ │ ├── details.module.ts │ │ │ └── ibdetail │ │ │ │ ├── ibdetail.component.html │ │ │ │ ├── ibdetail.component.scss │ │ │ │ ├── ibdetail.component.spec.ts │ │ │ │ └── ibdetail.component.ts │ │ ├── orderbooks │ │ │ ├── orderbooks-routing.module.ts │ │ │ ├── orderbooks.module.ts │ │ │ └── orderbooks │ │ │ │ ├── orderbooks.component.html │ │ │ │ ├── orderbooks.component.scss │ │ │ │ ├── orderbooks.component.spec.ts │ │ │ │ └── orderbooks.component.ts │ │ ├── overview │ │ │ ├── login │ │ │ │ ├── login.component.html │ │ │ │ ├── login.component.scss │ │ │ │ ├── login.component.spec.ts │ │ │ │ └── login.component.ts │ │ │ ├── overview-routing.module.ts │ │ │ ├── overview.module.ts │ │ │ └── quoteoverview │ │ │ │ ├── quoteoverview.component.html │ │ │ │ ├── quoteoverview.component.scss │ │ │ │ ├── quoteoverview.component.spec.ts │ │ │ │ └── quoteoverview.component.ts │ │ ├── services │ │ │ ├── auth-guard.service.spec.ts │ │ │ ├── auth-guard.service.ts │ │ │ ├── bitfinex.service.spec.ts │ │ │ ├── bitfinex.service.ts │ │ │ ├── bitstamp.service.spec.ts │ │ │ ├── bitstamp.service.ts │ │ │ ├── coinbase.service.spec.ts │ │ │ ├── coinbase.service.ts │ │ │ ├── itbit.service.spec.ts │ │ │ ├── itbit.service.ts │ │ │ ├── myuser.service.spec.ts │ │ │ ├── myuser.service.ts │ │ │ ├── statistic.service.spec.ts │ │ │ ├── statistic.service.ts │ │ │ └── utils.ts │ │ ├── splash │ │ │ ├── splash.component.html │ │ │ ├── splash.component.scss │ │ │ ├── splash.component.spec.ts │ │ │ └── splash.component.ts │ │ └── statistics │ │ │ ├── statistic-details │ │ │ ├── statistic-details.component.html │ │ │ ├── statistic-details.component.scss │ │ │ ├── statistic-details.component.spec.ts │ │ │ └── statistic-details.component.ts │ │ │ ├── statistics-routing.module.ts │ │ │ ├── statistics.component.html │ │ │ ├── statistics.component.scss │ │ │ ├── statistics.component.spec.ts │ │ │ ├── statistics.component.ts │ │ │ └── statistics.module.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ ├── test.ts │ └── typings.d.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── tslint.json ├── minikube ├── angularandspring │ ├── .helmignore │ ├── Chart.yaml │ ├── templates │ │ ├── _helpers.tpl │ │ └── kubTemplate.yaml │ └── values.yaml ├── angularandspringwithkafka │ ├── .helmignore │ ├── Chart.yaml │ ├── templates │ │ ├── _helpers.tpl │ │ └── kubTemplate.yaml │ └── values.yaml ├── helmCommand.sh ├── kafka │ ├── .helmignore │ ├── Chart.yaml │ ├── templates │ │ ├── _helpers.tpl │ │ └── kubTemplate.yaml │ └── values.yaml └── minikubeSetup.sh ├── mvnw ├── mvnw.cmd ├── pom.xml ├── prometheus-local.yml ├── runDocker.sh ├── runGrafana.sh ├── runKafka.sh ├── runMongoDBDocker.sh ├── runPrometheus.sh ├── runStructurizr.sh └── structurizr ├── .gitignore ├── diagrams ├── structurizr-1-Components.svg ├── structurizr-1-Containers.svg └── structurizr-1-SystemContext.svg └── workspace.dsl /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | /src/main/resources/static 4 | 5 | ### STS ### 6 | #.apt_generated 7 | #.classpath 8 | #.factorypath 9 | #.project 10 | #.settings 11 | #.springBeans 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | nbproject/private/ 21 | build/ 22 | nbbuild/ 23 | dist/ 24 | nbdist/ 25 | .nb-gradle/ 26 | /bin/ 27 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/AngularAndSpring/a61ec971a07ea31b3861915b81694d4f20d3ac1b/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | angularandspring 4 | 5 | 6 | angularandspring-backend 7 | angularandspring-frontend 8 | 9 | 10 | 11 | org.eclipse.m2e.core.maven2Builder 12 | 13 | 14 | 15 | 16 | 17 | org.eclipse.m2e.core.maven2Nature 18 | 19 | 20 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | jdk: 4 | - oraclejdk11 5 | 6 | addons: 7 | chrome: beta 8 | 9 | services: 10 | - docker 11 | 12 | notifications: 13 | email: 14 | - angular2guy@gmx.ch 15 | on_success: always 16 | on_failure: always 17 | 18 | before_install: 19 | - nvm install 14.15 20 | - nvm use 14.15 21 | 22 | 23 | script: 24 | mvn clean install -Ddocker=true 25 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM eclipse-temurin:24-jdk 2 | VOLUME /tmp 3 | ARG JAR_FILE 4 | ADD backend/target/${JAR_FILE} /app.jar 5 | ENV JAVA_OPTS="-XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:+UseStringDeduplication -XX:MaxDirectMemorySize=64m" 6 | ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar 7 | -------------------------------------------------------------------------------- /backend/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /backend/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | angularandspring-backend 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /backend/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /backend/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=24 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 12 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 13 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 14 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 15 | org.eclipse.jdt.core.compiler.release=enabled 16 | org.eclipse.jdt.core.compiler.source=21 17 | -------------------------------------------------------------------------------- /backend/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /backend/src/main/java/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/TraderApplication.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | 21 | import io.swagger.v3.oas.annotations.OpenAPIDefinition; 22 | import io.swagger.v3.oas.annotations.info.Info; 23 | 24 | @SpringBootApplication 25 | @OpenAPIDefinition(info = @Info(title = "Trader API", version = "1.0", description = "Crypto Currency Information")) 26 | public class TraderApplication { 27 | 28 | public static void main(String[] args) { 29 | SpringApplication.run(TraderApplication.class, args); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/clients/MongoDbClient.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.clients; 17 | 18 | import org.springframework.boot.autoconfigure.SpringBootApplication; 19 | import org.springframework.context.annotation.ComponentScan; 20 | import org.springframework.scheduling.annotation.EnableScheduling; 21 | 22 | @SpringBootApplication 23 | @EnableScheduling 24 | @ComponentScan 25 | public class MongoDbClient { 26 | 27 | // @Autowired 28 | // private ReactiveMongoOperations operations; 29 | // public static void main(String[] args) { 30 | // SpringApplication.run(TraderApplication.class, args); 31 | 32 | // mdbc.operations.collectionExists(QuoteBs.class) 33 | // .flatMap(col -> col ? mdbc.operations.dropCollection(QuoteBs.class) : Mono.just(col)) 34 | // .flatMap(o -> mdbc.operations.createCollection(QuoteBs.class)) 35 | // .then() 36 | // .block(); 37 | 38 | // } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/clients/MongoDbConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.clients; 17 | 18 | import org.springframework.data.mongodb.config.AbstractReactiveMongoConfiguration; 19 | import org.springframework.data.mongodb.repository.config.EnableReactiveMongoRepositories; 20 | 21 | import com.mongodb.reactivestreams.client.MongoClient; 22 | import com.mongodb.reactivestreams.client.MongoClients; 23 | 24 | 25 | @EnableReactiveMongoRepositories 26 | public class MongoDbConfiguration extends AbstractReactiveMongoConfiguration { 27 | 28 | @Override 29 | protected String getDatabaseName() { 30 | return "traderdb"; 31 | } 32 | 33 | @Override 34 | public MongoClient reactiveMongoClient() { 35 | return MongoClients.create("mongodb://localhost/"+getDatabaseName()); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/clients/RestOrderBookClient.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.clients; 17 | 18 | import org.springframework.http.MediaType; 19 | import org.springframework.http.client.reactive.ReactorClientHttpConnector; 20 | import org.springframework.stereotype.Service; 21 | import org.springframework.web.reactive.function.client.WebClient; 22 | 23 | import ch.xxx.trader.domain.common.WebUtils; 24 | import ch.xxx.trader.domain.services.MyOrderBookClient; 25 | import reactor.core.publisher.Mono; 26 | 27 | @Service 28 | public class RestOrderBookClient implements MyOrderBookClient { 29 | private static final String URLBF = "https://api.bitfinex.com"; 30 | private static final String URLBS = "https://www.bitstamp.net/api"; 31 | private static final String URLIB = "https://api.itbit.com"; 32 | 33 | public Mono getOrderbookBitfinex(String currpair) { 34 | WebClient wc = this.buildWebClient(URLBF); 35 | return wc.get().uri("/v1/book/" + currpair + "/").accept(MediaType.APPLICATION_JSON) 36 | .exchangeToMono(res -> res.bodyToMono(String.class)); 37 | } 38 | 39 | public Mono getOrderbookBitstamp(String currpair) { 40 | WebClient wc = this.buildWebClient(URLBS); 41 | return wc.get().uri("/v2/order_book/" + currpair + "/").accept(MediaType.APPLICATION_JSON) 42 | .exchangeToMono(res -> res.bodyToMono(String.class)); 43 | } 44 | 45 | public Mono getOrderbookItbit(String currpair) { 46 | WebClient wc = WebUtils.buildWebClient(URLIB); 47 | return wc.get().uri("/v1/markets/" + currpair + "/order_book").accept(MediaType.APPLICATION_JSON) 48 | .exchangeToMono(res -> res.bodyToMono(String.class)); 49 | } 50 | 51 | private WebClient buildWebClient(String url) { 52 | ReactorClientHttpConnector connector = new ReactorClientHttpConnector(); 53 | return WebClient.builder().clientConnector(connector).baseUrl(url).build(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/clients/test/RestClientBitfinex.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.clients.test; 17 | 18 | import org.springframework.http.MediaType; 19 | import org.springframework.web.reactive.function.client.WebClient; 20 | 21 | import ch.xxx.trader.domain.model.entity.QuoteBf; 22 | 23 | public class RestClientBitfinex { 24 | private static final String URL = "https://api.bitfinex.com"; 25 | 26 | public static void main(String[] args) { 27 | WebClient wc = WebClient.create(URL); 28 | QuoteBf quote = wc.get().uri("/v1/pubticker/xrpusd") 29 | .accept(MediaType.APPLICATION_JSON).exchangeToMono(response -> response.bodyToMono(QuoteBf.class)) 30 | .map(res -> {res.setPair("xprusd");return res;}).block(); 31 | System.out.println(quote.toString()); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/clients/test/RestClientBitstamp.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.clients.test; 17 | 18 | import org.springframework.http.MediaType; 19 | import org.springframework.web.reactive.function.client.WebClient; 20 | 21 | import ch.xxx.trader.domain.model.entity.QuoteBs; 22 | 23 | public class RestClientBitstamp { 24 | private static final String URL = "https://www.bitstamp.net/api"; 25 | 26 | public static void main(String[] args) { 27 | WebClient wc = WebClient.create(URL); 28 | QuoteBs quote = wc.get().uri("/v2/ticker/xrpeur/") 29 | .accept(MediaType.APPLICATION_JSON).exchangeToMono(response -> response.bodyToMono(QuoteBs.class)) 30 | .map(res -> {res.setPair("xrpeur");return res;}).block(); 31 | System.out.println(quote.toString()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/clients/test/RestClientItbit.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.clients.test; 17 | 18 | import org.springframework.http.MediaType; 19 | import org.springframework.web.reactive.function.client.WebClient; 20 | 21 | import ch.xxx.trader.domain.model.entity.QuoteIb; 22 | 23 | public class RestClientItbit { 24 | 25 | private static final String URL = "https://api.itbit.com"; 26 | 27 | public static void main(String[] args) { 28 | WebClient wc = WebClient.create(URL); 29 | QuoteIb quote = wc.get().uri("/v1/markets/XBTUSD/ticker") 30 | .accept(MediaType.APPLICATION_JSON).exchangeToMono(response -> response.bodyToMono(QuoteIb.class)) 31 | .block(); 32 | System.out.println(quote.toString()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/clients/test/WsClient.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.clients.test; 17 | 18 | import java.net.URI; 19 | import java.time.Duration; 20 | 21 | import org.springframework.web.reactive.socket.WebSocketMessage; 22 | import org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient; 23 | import org.springframework.web.reactive.socket.client.WebSocketClient; 24 | 25 | import reactor.core.publisher.Mono; 26 | 27 | public class WsClient { 28 | public static void main(String[] args) throws InterruptedException { 29 | WebSocketClient client = new ReactorNettyWebSocketClient(); 30 | client.execute(URI.create("wss://echo.websocket.org"), 31 | session -> session.send(Mono.just( 32 | session.textMessage("{\"event\":\"ping\"}"))) 33 | .thenMany(session 34 | .receive() 35 | .map(WebSocketMessage::getPayloadAsText) 36 | .log()) 37 | .then()).block(Duration.ofSeconds(10)); 38 | System.out.println("End"); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/config/FlapDoodleConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.config; 17 | 18 | //@Configuration 19 | public class FlapDoodleConfig { 20 | /* 21 | private static final Logger LOGGER = LoggerFactory.getLogger(FlapDoodleConfig.class); 22 | private static final int MONGO_DB_PORT = 27017; 23 | private MongodExecutable mongodExecutable = null; 24 | private MongodProcess mongod = null; 25 | @Value("${server.port:}") 26 | private String serverPort; 27 | @Value("${spring.profiles.active:}") 28 | private String activeProfiles; 29 | 30 | @PostConstruct 31 | public void initMongoDb() { 32 | if (this.serverPort.isBlank() || this.serverPort.contains("8080") || this.serverPort.matches("\\d") 33 | && (this.activeProfiles.isBlank() || !this.activeProfiles.toLowerCase().contains("prod"))) { 34 | try { 35 | MongodStarter starter = MongodStarter.getDefaultInstance(); 36 | MongodConfig mongodConfig = MongodConfig.builder().version(Version.Main.V4_4) 37 | .net(new Net(MONGO_DB_PORT, Network.localhostIsIPv6())).build(); 38 | this.mongodExecutable = starter.prepare(mongodConfig); 39 | this.mongod = this.mongodExecutable.start(); 40 | LOGGER.info("MongoDb process: {}, state: {}", this.mongod.getProcessId(), 41 | this.mongod.isProcessRunning()); 42 | } catch (IOException e) { 43 | throw new RuntimeException(e); 44 | } 45 | } 46 | } 47 | 48 | @PreDestroy 49 | public void stopMongoDb() { 50 | if (this.serverPort.isBlank() || this.serverPort.contains("8080") || this.serverPort.matches("\\d") 51 | && (this.activeProfiles.isBlank() || !this.activeProfiles.toLowerCase().contains("prod"))) { 52 | try { 53 | this.mongodExecutable.stop(); 54 | LOGGER.info("MongoDb proces: {}, state: {}", this.mongod.getProcessId(), 55 | this.mongod.isProcessRunning()); 56 | } catch (Exception e) { 57 | throw new RuntimeException(e); 58 | } 59 | } 60 | } 61 | */ 62 | } 63 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/config/JwtTokenFilter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.config; 17 | 18 | import java.io.IOException; 19 | 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | import org.springframework.security.core.Authentication; 23 | import org.springframework.security.core.context.SecurityContextHolder; 24 | import org.springframework.web.filter.GenericFilterBean; 25 | 26 | import ch.xxx.trader.usecase.services.JwtTokenService; 27 | import jakarta.servlet.FilterChain; 28 | import jakarta.servlet.ServletException; 29 | import jakarta.servlet.ServletRequest; 30 | import jakarta.servlet.ServletResponse; 31 | import jakarta.servlet.http.HttpServletRequest; 32 | 33 | public class JwtTokenFilter extends GenericFilterBean { 34 | private static final Logger LOGGER = LoggerFactory.getLogger(JwtTokenFilter.class); 35 | 36 | private JwtTokenService jwtTokenProvider; 37 | 38 | public JwtTokenFilter(JwtTokenService jwtTokenProvider) { 39 | this.jwtTokenProvider = jwtTokenProvider; 40 | } 41 | 42 | @Override 43 | public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain) 44 | throws IOException, ServletException { 45 | 46 | String token = jwtTokenProvider.resolveToken((HttpServletRequest) req); 47 | if (token != null && jwtTokenProvider.validateToken(token)) { 48 | Authentication auth = token != null ? jwtTokenProvider.getAuthentication(token) : null; 49 | SecurityContextHolder.getContext().setAuthentication(auth); 50 | } else { 51 | LOGGER.debug("Token rejected: {}", token); 52 | } 53 | 54 | filterChain.doFilter(req, res); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/config/SchedulingConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.config; 17 | 18 | import java.util.concurrent.Executor; 19 | 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | import org.springframework.context.annotation.Bean; 23 | import org.springframework.context.annotation.Configuration; 24 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 25 | import org.springframework.scheduling.annotation.EnableAsync; 26 | import org.springframework.scheduling.annotation.EnableScheduling; 27 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 28 | 29 | import io.micrometer.core.aop.TimedAspect; 30 | import io.micrometer.core.instrument.MeterRegistry; 31 | import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock; 32 | 33 | @Configuration 34 | @EnableAspectJAutoProxy 35 | @EnableScheduling 36 | @EnableAsync 37 | @EnableSchedulerLock(defaultLockAtMostFor = "10m") 38 | public class SchedulingConfig { 39 | private static final Logger LOGGER = LoggerFactory.getLogger(SchedulingConfig.class); 40 | 41 | @Bean 42 | TimedAspect timedAspect(MeterRegistry registry) { 43 | return new TimedAspect(registry); 44 | } 45 | 46 | @Bean(name = "clientTaskExecutor") 47 | public Executor threadPoolTaskExecutor() { 48 | return this.createThreadPoolTaskExecutor(20); 49 | } 50 | 51 | private Executor createThreadPoolTaskExecutor(int maxPoolSize) { 52 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); 53 | executor.setMaxPoolSize(maxPoolSize); 54 | executor.setQueueCapacity(1); 55 | executor.setKeepAliveSeconds(1); 56 | executor.setAllowCoreThreadTimeOut(true); 57 | return executor; 58 | } 59 | } -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/controller/BitfinexController.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.controller; 17 | 18 | import org.springframework.http.MediaType; 19 | import org.springframework.web.bind.annotation.GetMapping; 20 | import org.springframework.web.bind.annotation.PathVariable; 21 | import org.springframework.web.bind.annotation.RequestMapping; 22 | import org.springframework.web.bind.annotation.RestController; 23 | 24 | import ch.xxx.trader.domain.model.entity.QuoteBf; 25 | import ch.xxx.trader.usecase.services.BitfinexService; 26 | import reactor.core.publisher.Flux; 27 | import reactor.core.publisher.Mono; 28 | 29 | @RestController 30 | @RequestMapping("/bitfinex") 31 | public class BitfinexController { 32 | private final BitfinexService bitfinexService; 33 | 34 | public BitfinexController(BitfinexService bitfinexService) { 35 | this.bitfinexService = bitfinexService; 36 | } 37 | 38 | @GetMapping("/{currpair}/orderbook") 39 | public Mono getOrderbook(@PathVariable String currpair) { 40 | return this.bitfinexService.getOrderbook(currpair); 41 | } 42 | 43 | @GetMapping("/{pair}/current") 44 | public Mono currentQuote(@PathVariable String pair) { 45 | return this.bitfinexService.currentQuote(pair); 46 | } 47 | 48 | @GetMapping("/{pair}/{timeFrame}") 49 | public Flux tfQuotes(@PathVariable String timeFrame, @PathVariable String pair) { 50 | return this.bitfinexService.tfQuotes(timeFrame, pair); 51 | } 52 | 53 | @GetMapping(path="/{pair}/{timeFrame}/pdf", produces=MediaType.APPLICATION_PDF_VALUE) 54 | public Mono pdfReport(@PathVariable String timeFrame, @PathVariable String pair) { 55 | return this.bitfinexService.pdfReport(timeFrame, pair); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/controller/BitstampController.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.controller; 17 | 18 | import org.springframework.http.MediaType; 19 | import org.springframework.web.bind.annotation.GetMapping; 20 | import org.springframework.web.bind.annotation.PathVariable; 21 | import org.springframework.web.bind.annotation.RequestMapping; 22 | import org.springframework.web.bind.annotation.RestController; 23 | 24 | import ch.xxx.trader.domain.model.entity.QuoteBs; 25 | import ch.xxx.trader.usecase.services.BitstampService; 26 | import reactor.core.publisher.Flux; 27 | import reactor.core.publisher.Mono; 28 | 29 | @RestController 30 | @RequestMapping("/bitstamp") 31 | public class BitstampController { 32 | private final BitstampService bitstampService; 33 | 34 | public BitstampController(BitstampService bitstampService) { 35 | this.bitstampService = bitstampService; 36 | } 37 | 38 | @GetMapping("/{currpair}/orderbook") 39 | public Mono getOrderbook(@PathVariable String currpair) { 40 | return this.bitstampService.getOrderbook(currpair); 41 | } 42 | 43 | @GetMapping("/{pair}/current") 44 | public Mono currentQuoteBtc(@PathVariable String pair) { 45 | return this.bitstampService.currentQuoteBtc(pair); 46 | } 47 | 48 | @GetMapping("/{pair}/{timeFrame}") 49 | public Flux tfQuotesBtc(@PathVariable String timeFrame, @PathVariable String pair) { 50 | return this.bitstampService.tfQuotesBtc(timeFrame, pair); 51 | } 52 | 53 | @GetMapping(path="/{pair}/{timeFrame}/pdf", produces=MediaType.APPLICATION_PDF_VALUE) 54 | public Mono pdfReport(@PathVariable String timeFrame, @PathVariable String pair) { 55 | return this.bitstampService.pdfReport(timeFrame, pair); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/controller/CoinbaseController.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.controller; 17 | 18 | import org.springframework.web.bind.annotation.GetMapping; 19 | import org.springframework.web.bind.annotation.RequestMapping; 20 | import org.springframework.web.bind.annotation.RestController; 21 | 22 | import ch.xxx.trader.domain.model.entity.QuoteCb; 23 | import ch.xxx.trader.domain.model.entity.QuoteCbSmall; 24 | import ch.xxx.trader.usecase.services.CoinbaseService; 25 | import reactor.core.publisher.Flux; 26 | import reactor.core.publisher.Mono; 27 | 28 | @RestController 29 | @RequestMapping("/coinbase") 30 | public class CoinbaseController { 31 | private final CoinbaseService coinbaseService; 32 | 33 | public CoinbaseController(CoinbaseService coinbaseService) { 34 | this.coinbaseService = coinbaseService; 35 | } 36 | 37 | @GetMapping("/today") 38 | public Flux todayQuotesBc() { 39 | return this.coinbaseService.todayQuotesBc(); 40 | } 41 | 42 | @GetMapping("/7days") 43 | public Flux sevenDaysQuotesBc() { 44 | return this.coinbaseService.sevenDaysQuotesBc(); 45 | } 46 | 47 | @GetMapping("/30days") 48 | public Flux thirtyDaysQuotesBc() { 49 | return this.coinbaseService.thirtyDaysQuotesBc(); 50 | } 51 | 52 | @GetMapping("/90days") 53 | public Flux nintyDaysQuotesBc() { 54 | return this.coinbaseService.nintyDaysQuotesBc(); 55 | } 56 | 57 | @GetMapping("/6month") 58 | public Flux sixMonthsQuotesBc() { 59 | return this.coinbaseService.sixMonthsQuotesBc(); 60 | } 61 | 62 | @GetMapping("/1year") 63 | public Flux oneYearQuotesBc() { 64 | return this.coinbaseService.oneYearQuotesBc(); 65 | } 66 | 67 | @GetMapping("/current") 68 | public Mono currentQuoteBc() { 69 | return this.coinbaseService.currentQuoteBc(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/controller/ItbitController.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.controller; 17 | 18 | import jakarta.servlet.http.HttpServletRequest; 19 | 20 | import org.springframework.http.MediaType; 21 | import org.springframework.web.bind.annotation.GetMapping; 22 | import org.springframework.web.bind.annotation.PathVariable; 23 | import org.springframework.web.bind.annotation.RequestMapping; 24 | import org.springframework.web.bind.annotation.RestController; 25 | 26 | import ch.xxx.trader.domain.model.entity.QuoteIb; 27 | import ch.xxx.trader.usecase.services.ItbitService; 28 | import reactor.core.publisher.Flux; 29 | import reactor.core.publisher.Mono; 30 | 31 | @RestController 32 | @RequestMapping("/itbit") 33 | public class ItbitController { 34 | private final ItbitService itbitService; 35 | 36 | public ItbitController(ItbitService itbitService) { 37 | this.itbitService = itbitService; 38 | } 39 | 40 | @GetMapping("/{currpair}/orderbook") 41 | public Mono getOrderbook(@PathVariable String currpair, HttpServletRequest request) { 42 | return this.itbitService.getOrderbook(currpair); 43 | } 44 | 45 | @GetMapping("/{pair}/current") 46 | public Mono currentQuote(@PathVariable String pair) { 47 | return this.itbitService.currentQuote(pair); 48 | } 49 | 50 | @GetMapping("/{pair}/{timeFrame}") 51 | public Flux tfQuotes(@PathVariable String timeFrame, @PathVariable String pair) { 52 | return this.itbitService.tfQuotes(timeFrame, pair); 53 | } 54 | 55 | @GetMapping(path="/{pair}/{timeFrame}/pdf", produces=MediaType.APPLICATION_PDF_VALUE) 56 | public Mono pdfReport(@PathVariable String timeFrame, @PathVariable String pair) { 57 | return this.itbitService.pdfReport(timeFrame, pair); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/controller/StatisticsController.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.controller; 17 | 18 | import org.slf4j.Logger; 19 | import org.slf4j.LoggerFactory; 20 | import org.springframework.web.bind.annotation.GetMapping; 21 | import org.springframework.web.bind.annotation.PathVariable; 22 | import org.springframework.web.bind.annotation.RequestMapping; 23 | import org.springframework.web.bind.annotation.RestController; 24 | 25 | import ch.xxx.trader.domain.model.dto.CommonStatisticsDto; 26 | import ch.xxx.trader.domain.model.dto.StatisticsCommon.CoinExchange; 27 | import ch.xxx.trader.domain.model.dto.StatisticsCommon.StatisticsCurrPair; 28 | import ch.xxx.trader.usecase.services.StatisticService; 29 | import reactor.core.publisher.Mono; 30 | 31 | @RestController 32 | @RequestMapping("/statistics") 33 | public class StatisticsController { 34 | private static final Logger LOGGER = LoggerFactory.getLogger(StatisticsController.class); 35 | private final StatisticService statisticService; 36 | 37 | public StatisticsController(StatisticService statisticService) { 38 | this.statisticService = statisticService; 39 | } 40 | 41 | @GetMapping("/overview/{coinExchange}/{currPair}") 42 | public Mono getOverview(@PathVariable StatisticsCurrPair currPair, @PathVariable CoinExchange coinExchange) { 43 | return this.statisticService.getCommonStatistics(currPair, coinExchange); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/cron/TaskStarter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.adapter.cron; 17 | 18 | import org.slf4j.Logger; 19 | import org.slf4j.LoggerFactory; 20 | import org.springframework.beans.factory.annotation.Value; 21 | import org.springframework.boot.context.event.ApplicationReadyEvent; 22 | import org.springframework.context.event.EventListener; 23 | import org.springframework.scheduling.annotation.Async; 24 | import org.springframework.stereotype.Component; 25 | 26 | import ch.xxx.trader.usecase.services.BitfinexService; 27 | import ch.xxx.trader.usecase.services.BitstampService; 28 | import ch.xxx.trader.usecase.services.CoinbaseService; 29 | import ch.xxx.trader.usecase.services.ItbitService; 30 | 31 | @Component 32 | public class TaskStarter { 33 | private static final Logger log = LoggerFactory.getLogger(TaskStarter.class); 34 | private final BitstampService bitstampService; 35 | private final BitfinexService bitfinexService; 36 | private final ItbitService itbitService; 37 | private final CoinbaseService coinbaseService; 38 | @Value("${single.instance.deployment:false}") 39 | private boolean singleInstanceDeployment; 40 | 41 | public TaskStarter(BitstampService bitstampService, BitfinexService bitfinexService, ItbitService itbitService, 42 | CoinbaseService coinbaseService) { 43 | this.bitstampService = bitstampService; 44 | this.bitfinexService = bitfinexService; 45 | this.itbitService = itbitService; 46 | this.coinbaseService = coinbaseService; 47 | } 48 | 49 | @Async 50 | @EventListener(ApplicationReadyEvent.class) 51 | public void initAvgs() { 52 | if (this.singleInstanceDeployment) { 53 | log.info("ApplicationReady"); 54 | this.bitstampService.createBsAvg().block(); 55 | this.bitfinexService.createBfAvg().block(); 56 | this.itbitService.createIbAvg().block(); 57 | this.coinbaseService.createCbAvg().block(); 58 | BitstampService.singleInstanceLock = false; 59 | BitfinexService.singleInstanceLock = false; 60 | ItbitService.singleInstanceLock = false; 61 | CoinbaseService.singleInstanceLock = false; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/adapter/events/EventProducer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Sven Loesekann 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | package ch.xxx.trader.adapter.events; 14 | 15 | import org.apache.kafka.clients.producer.ProducerRecord; 16 | import org.slf4j.Logger; 17 | import org.slf4j.LoggerFactory; 18 | import org.springframework.context.annotation.Profile; 19 | import org.springframework.stereotype.Service; 20 | 21 | import ch.xxx.trader.adapter.config.KafkaConfig; 22 | import ch.xxx.trader.domain.model.entity.MyUser; 23 | import ch.xxx.trader.domain.model.entity.RevokedToken; 24 | import ch.xxx.trader.domain.services.MyEventProducer; 25 | import ch.xxx.trader.usecase.mappers.EventMapper; 26 | import reactor.core.publisher.Mono; 27 | import reactor.kafka.sender.KafkaSender; 28 | 29 | @Profile("kafka | prod") 30 | @Service 31 | public class EventProducer implements MyEventProducer { 32 | private static final Logger LOGGER = LoggerFactory.getLogger(EventProducer.class); 33 | private final KafkaSender kafkaSender; 34 | private final EventMapper eventMapper; 35 | 36 | public EventProducer(KafkaSender kafkaSender, EventMapper eventMapper) { 37 | this.kafkaSender = kafkaSender; 38 | this.eventMapper = eventMapper; 39 | } 40 | 41 | public Mono sendNewUser(MyUser dto) { 42 | String dtoJson = this.eventMapper.mapDtoToString(dto); 43 | return this.kafkaSender.createOutbound() 44 | .send(Mono.just(new ProducerRecord<>(KafkaConfig.NEW_USER_TOPIC, dto.getSalt(), dtoJson))) 45 | .then() 46 | .doOnError(e -> LOGGER.error( 47 | String.format("Failed to send topic: %s value: %s", KafkaConfig.NEW_USER_TOPIC, dtoJson), e)) 48 | .thenReturn(dto); 49 | 50 | } 51 | 52 | public Mono sendUserLogout(RevokedToken dto) { 53 | String dtoJson = this.eventMapper.mapDtoToString(dto); 54 | return this.kafkaSender.createOutbound() 55 | .send(Mono.just(new ProducerRecord<>(KafkaConfig.USER_LOGOUT_SOURCE_TOPIC, dto.getName(), dtoJson))) 56 | .then() 57 | .doOnError(e -> LOGGER.error(String.format("Failed to send topic: %s value: %s", 58 | KafkaConfig.USER_LOGOUT_SOURCE_TOPIC, dtoJson), e)) 59 | .thenReturn(dto); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/common/PasswordEncryption.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.common; 17 | 18 | import java.security.NoSuchAlgorithmException; 19 | import java.security.SecureRandom; 20 | import java.security.spec.InvalidKeySpecException; 21 | import java.security.spec.KeySpec; 22 | import java.util.Base64; 23 | 24 | import javax.crypto.SecretKeyFactory; 25 | import javax.crypto.spec.PBEKeySpec; 26 | 27 | import org.springframework.stereotype.Component; 28 | 29 | @Component 30 | public class PasswordEncryption { 31 | 32 | public boolean authenticate(String attemptedPassword, String encryptedPassword, String salt) 33 | throws NoSuchAlgorithmException, InvalidKeySpecException { 34 | String encryptedAttemptedPassword = getEncryptedPassword(attemptedPassword, salt); 35 | return encryptedPassword.equals(encryptedAttemptedPassword); 36 | 37 | } 38 | 39 | public String getEncryptedPassword(String password, String salt) 40 | throws NoSuchAlgorithmException, InvalidKeySpecException { 41 | String algorithm = "PBKDF2WithHmacSHA256"; 42 | int derivedKeyLength = 256; 43 | int iterations = 20000; 44 | char[] pwd = new String(password).toCharArray(); 45 | KeySpec spec = new PBEKeySpec(pwd, Base64.getDecoder().decode(salt), iterations, derivedKeyLength); 46 | SecretKeyFactory f = SecretKeyFactory.getInstance(algorithm); 47 | byte[] bytes = f.generateSecret(spec).getEncoded(); 48 | return Base64.getEncoder().encodeToString(bytes); 49 | } 50 | 51 | public String generateSalt() throws NoSuchAlgorithmException { 52 | SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); 53 | byte[] salt = new byte[8]; 54 | random.nextBytes(salt); 55 | return Base64.getEncoder().encodeToString(salt); 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/common/Role.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.common; 17 | 18 | import org.springframework.security.core.GrantedAuthority; 19 | 20 | public enum Role implements GrantedAuthority{ 21 | USERS, GUEST; 22 | 23 | @Override 24 | public String getAuthority() { 25 | return this.name(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/common/StreamHelpers.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Sven Loesekann 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | package ch.xxx.trader.domain.common; 14 | 15 | import java.util.Collection; 16 | import java.util.List; 17 | import java.util.Map; 18 | import java.util.Optional; 19 | import java.util.concurrent.ConcurrentHashMap; 20 | import java.util.function.Function; 21 | import java.util.function.Predicate; 22 | import java.util.stream.Stream; 23 | 24 | public class StreamHelpers { 25 | public static Predicate distinctByKey( 26 | Function super T, ?> keyExtractor) { 27 | 28 | Map seen = new ConcurrentHashMap<>(); 29 | return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; 30 | } 31 | 32 | public static Stream toStream(Collection collection) { 33 | return Optional.ofNullable(collection).stream().flatMap(myList -> myList.stream()); 34 | } 35 | 36 | public static Stream toStream(T[] array) { 37 | return Optional.ofNullable(array).stream().flatMap(myArray -> List.of(array).stream()); 38 | } 39 | 40 | public static Stream toStream(T object) { 41 | return Optional.ofNullable(object).stream(); 42 | } 43 | 44 | public static Stream unboxOptionals(Stream> optSteam) { 45 | return optSteam.filter(Optional::isPresent).map(Optional::get); 46 | } 47 | 48 | public static Stream unboxOptionals(Optional opt) { 49 | return opt.stream(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/common/WebUtils.java: -------------------------------------------------------------------------------- 1 | package ch.xxx.trader.domain.common; 2 | 3 | import java.time.Duration; 4 | import java.time.Instant; 5 | import java.util.Map; 6 | import java.util.Optional; 7 | 8 | import org.springframework.http.client.reactive.ReactorClientHttpConnector; 9 | import org.springframework.web.reactive.function.client.WebClient; 10 | 11 | import jakarta.servlet.http.HttpServletRequest; 12 | 13 | public class WebUtils { 14 | 15 | public static final String LASTOBCALLBF = "LAST_ORDERBOOK_CALL_BITFINEX"; 16 | public static final String LASTOBCALLBS = "LAST_ORDERBOOK_CALL_BITSTAMP"; 17 | public static final String LASTOBCALLIB = "LAST_ORDERBOOK_CALL_ITBIT"; 18 | public static final String SECURITYCONTEXT = "SPRING_SECURITY_CONTEXT"; 19 | public static final String AUTHORIZATION = "authorization"; 20 | 21 | public static boolean checkOBRequest(HttpServletRequest request, String sessionKey) { 22 | Instant last = (Instant) request.getSession().getAttribute(sessionKey); 23 | Duration dur = Duration.ofSeconds(10); 24 | Instant next = last == null ? Instant.now() : last.plus(dur); 25 | Instant now = Instant.now(); 26 | if (last == null || now.isAfter(next)) { 27 | request.getSession().setAttribute(sessionKey, now); 28 | return true; 29 | } 30 | return false; 31 | } 32 | 33 | public static WebClient buildWebClient(String url) { 34 | ReactorClientHttpConnector connector = new ReactorClientHttpConnector(); 35 | return WebClient.builder().clientConnector(connector).baseUrl(url).build(); 36 | } 37 | 38 | public static Optional extractToken(Map headers) { 39 | String authStr = headers.get(AUTHORIZATION); 40 | return extractToken(Optional.ofNullable(authStr)); 41 | } 42 | 43 | private static Optional extractToken(Optional authStr) { 44 | if(authStr.isPresent()) { 45 | authStr = Optional.ofNullable(authStr.get().startsWith("Bearer ") ? authStr.get().substring(7) : null); 46 | } 47 | return authStr; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/exceptions/AuthenticationException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Sven Loesekann 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | package ch.xxx.trader.domain.exceptions; 14 | 15 | public class AuthenticationException extends RuntimeException { 16 | 17 | private static final long serialVersionUID = -4778173207515812187L; 18 | 19 | public AuthenticationException(String message) { 20 | super(message); 21 | } 22 | 23 | public AuthenticationException(String message, Throwable th) { 24 | super(message, th); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/exceptions/JwtTokenValidationException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.exceptions; 17 | 18 | public class JwtTokenValidationException extends RuntimeException { 19 | 20 | private static final long serialVersionUID = -1119114699758662609L; 21 | 22 | public JwtTokenValidationException(String message) { 23 | super(message); 24 | } 25 | 26 | public JwtTokenValidationException(String message, Throwable th) { 27 | super(message, th); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/exceptions/MyErrorAttributes.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.exceptions; 17 | 18 | import org.springframework.boot.web.reactive.error.DefaultErrorAttributes; 19 | import org.springframework.stereotype.Component; 20 | 21 | @Component 22 | public class MyErrorAttributes extends DefaultErrorAttributes { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/dto/AuthCheck.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.dto; 17 | 18 | import java.util.Date; 19 | 20 | import com.fasterxml.jackson.annotation.JsonProperty; 21 | 22 | public class AuthCheck { 23 | @JsonProperty 24 | private final Date createdAt = new Date(); 25 | private final String hash; 26 | private final String path; 27 | private final boolean authorized; 28 | 29 | public AuthCheck(@JsonProperty("hash") String hash,@JsonProperty("path") String path, @JsonProperty("authorized") boolean authorized) { 30 | super(); 31 | this.hash = hash; 32 | this.path = path; 33 | this.authorized = authorized; 34 | } 35 | 36 | public Date getCreatedAt() { 37 | return createdAt; 38 | } 39 | 40 | public String getHash() { 41 | return hash; 42 | } 43 | 44 | public String getPath() { 45 | return path; 46 | } 47 | 48 | public boolean isAuthorized() { 49 | return authorized; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "AuthCheck [createdAt=" + createdAt + ", hash=" + hash + ", path=" + path + ", authorized=" + authorized 55 | + "]"; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/dto/CurrencyCb.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.dto; 17 | 18 | import com.fasterxml.jackson.annotation.JsonProperty; 19 | 20 | import ch.xxx.trader.domain.model.entity.QuoteCb; 21 | 22 | public class CurrencyCb { 23 | private final String currency; 24 | private final QuoteCb rates; 25 | 26 | public CurrencyCb(@JsonProperty("currency")String currency,@JsonProperty("rates") QuoteCb rates) { 27 | super(); 28 | this.currency = currency; 29 | this.rates = rates; 30 | } 31 | public String getCurrency() { 32 | return currency; 33 | } 34 | public QuoteCb getRates() { 35 | return rates; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/dto/QuotePdf.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.dto; 17 | 18 | import java.math.BigDecimal; 19 | import java.util.Date; 20 | 21 | public class QuotePdf { 22 | private BigDecimal last; 23 | private String pair; 24 | private BigDecimal volume; 25 | private Date timestamp; 26 | private BigDecimal bid; 27 | private BigDecimal ask; 28 | 29 | public QuotePdf() { 30 | 31 | } 32 | 33 | public QuotePdf(BigDecimal last, String pair, BigDecimal volume, Date timestamp, BigDecimal bid, BigDecimal ask) { 34 | super(); 35 | this.last = last; 36 | this.pair = pair; 37 | this.volume = volume; 38 | this.timestamp = timestamp; 39 | this.bid = bid; 40 | this.ask = ask; 41 | } 42 | public BigDecimal getLast() { 43 | return last; 44 | } 45 | public void setLast(BigDecimal last) { 46 | this.last = last; 47 | } 48 | public String getPair() { 49 | return pair; 50 | } 51 | public void setPair(String pair) { 52 | this.pair = pair; 53 | } 54 | public BigDecimal getVolume() { 55 | return volume; 56 | } 57 | public void setVolume(BigDecimal volume) { 58 | this.volume = volume; 59 | } 60 | public Date getTimestamp() { 61 | return timestamp; 62 | } 63 | public void setTimestamp(Date timestamp) { 64 | this.timestamp = timestamp; 65 | } 66 | public BigDecimal getBid() { 67 | return bid; 68 | } 69 | public void setBid(BigDecimal bid) { 70 | this.bid = bid; 71 | } 72 | public BigDecimal getAsk() { 73 | return ask; 74 | } 75 | public void setAsk(BigDecimal ask) { 76 | this.ask = ask; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/dto/RangeDto.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.dto; 17 | 18 | import java.math.BigDecimal; 19 | 20 | public class RangeDto { 21 | private BigDecimal min = BigDecimal.ZERO; 22 | private BigDecimal max = BigDecimal.ZERO; 23 | 24 | public RangeDto() {} 25 | 26 | public RangeDto(BigDecimal min, BigDecimal max) { 27 | this.min = min; 28 | this.max = max; 29 | } 30 | 31 | public BigDecimal getMin() { 32 | return min; 33 | } 34 | 35 | public BigDecimal getMax() { 36 | return max; 37 | } 38 | 39 | public void setMin(BigDecimal min) { 40 | this.min = min; 41 | } 42 | 43 | public void setMax(BigDecimal max) { 44 | this.max = max; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/dto/RefreshTokenDto.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Sven Loesekann 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | package ch.xxx.trader.domain.model.dto; 14 | 15 | public class RefreshTokenDto { 16 | private String refreshToken; 17 | 18 | public RefreshTokenDto(String refreshToken) { 19 | super(); 20 | this.refreshToken = refreshToken; 21 | } 22 | 23 | public String getRefreshToken() { 24 | return refreshToken; 25 | } 26 | 27 | public void setRefreshToken(String refreshToken) { 28 | this.refreshToken = refreshToken; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/dto/RevokedTokensDto.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.dto; 17 | 18 | import java.util.LinkedList; 19 | import java.util.List; 20 | 21 | import ch.xxx.trader.domain.model.entity.RevokedToken; 22 | 23 | public class RevokedTokensDto { 24 | private List revokedTokens = new LinkedList<>(); 25 | 26 | public RevokedTokensDto() { 27 | } 28 | 29 | public RevokedTokensDto(List revokedTokens) { 30 | super(); 31 | this.revokedTokens = revokedTokens; 32 | } 33 | 34 | public List getRevokedTokens() { 35 | return revokedTokens; 36 | } 37 | 38 | public void setRevokedTokens(List revokedTokens) { 39 | this.revokedTokens = revokedTokens; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/dto/StatisticsCommon.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.dto; 17 | 18 | public class StatisticsCommon { 19 | public static enum StatisticsCurrPair { 20 | BcUsd("btcusd","btcusd"), EthUsd("ethusd","ethusd"), LcUsd("ltcusd","ltcusd"), RpUsd("xrpusd","xrpusd"); 21 | 22 | private String bitStampKey; 23 | private String bitfinexKey; 24 | 25 | StatisticsCurrPair(String bitStampKey, String bitfinexKey) { 26 | this.bitStampKey = bitStampKey; 27 | this.bitfinexKey = bitfinexKey; 28 | } 29 | 30 | public String getBitStampKey() { 31 | return bitStampKey; 32 | } 33 | 34 | public String getBitfinexKey() { 35 | return bitfinexKey; 36 | } 37 | } 38 | 39 | public enum CoinExchange { 40 | Bitfinex, Bitstamp 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/dto/WrapperCb.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.dto; 17 | 18 | import com.fasterxml.jackson.annotation.JsonProperty; 19 | 20 | public class WrapperCb { 21 | private final CurrencyCb data; 22 | 23 | public WrapperCb(@JsonProperty("data") CurrencyCb data) { 24 | super(); 25 | this.data = data; 26 | } 27 | 28 | public CurrencyCb getData() { 29 | return data; 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/entity/MyMongoRepository.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.entity; 17 | 18 | import java.util.Collection; 19 | 20 | import org.bson.Document; 21 | import org.springframework.data.mongodb.core.query.Query; 22 | 23 | import com.mongodb.client.result.DeleteResult; 24 | import com.mongodb.reactivestreams.client.MongoCollection; 25 | 26 | import reactor.core.publisher.Flux; 27 | import reactor.core.publisher.Mono; 28 | 29 | public interface MyMongoRepository { 30 | 31 | Mono findOne(Query query, Class entityClass); 32 | 33 | Mono findOne(Query query, Class entityClass, String name); 34 | 35 | Flux find(Query query, Class entityClass); 36 | 37 | Flux find(Query query, Class entityClass, String collectionName); 38 | 39 | Flux insertAll(Mono extends Collection extends T>> batchToSave, String collectionName); 40 | 41 | Mono insert(Mono quote); 42 | 43 | Mono collectionExists(String collectionName); 44 | 45 | Mono> createCollection(String collectionName); 46 | 47 | Mono save(T objectToSave); 48 | 49 | Mono remove(Mono quote); 50 | 51 | Mono ensureIndex(String collectionName, String propertyName); 52 | } 53 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/entity/Quote.java: -------------------------------------------------------------------------------- 1 | package ch.xxx.trader.domain.model.entity; 2 | 3 | import java.util.Date; 4 | 5 | public interface Quote { 6 | Date getCreatedAt(); 7 | } 8 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/entity/QuoteCbSmall.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.entity; 17 | 18 | import java.math.BigDecimal; 19 | import java.util.Date; 20 | 21 | import org.bson.types.ObjectId; 22 | import org.springframework.data.annotation.Id; 23 | import org.springframework.data.mongodb.core.mapping.Document; 24 | 25 | import com.fasterxml.jackson.annotation.JsonProperty; 26 | 27 | @Document 28 | public class QuoteCbSmall implements Quote { 29 | @Id 30 | private ObjectId _id; 31 | private final Date createdAt; 32 | private final BigDecimal usd; 33 | private final BigDecimal eur; 34 | private final BigDecimal eth; 35 | private final BigDecimal ltc; 36 | 37 | public QuoteCbSmall(@JsonProperty("createdAt") Date createdAt, @JsonProperty("usd") BigDecimal usd, @JsonProperty("eur") BigDecimal eur, 38 | @JsonProperty("eth") BigDecimal eth, @JsonProperty("ltc") BigDecimal ltc) { 39 | super(); 40 | this.createdAt = createdAt; 41 | this.usd = usd; 42 | this.eur = eur; 43 | this.eth = eth; 44 | this.ltc = ltc; 45 | } 46 | 47 | public ObjectId get_id() { 48 | return _id; 49 | } 50 | 51 | public void set_id(ObjectId _id) { 52 | this._id = _id; 53 | } 54 | 55 | public Date getCreatedAt() { 56 | return createdAt; 57 | } 58 | 59 | public BigDecimal getUsd() { 60 | return usd; 61 | } 62 | 63 | public BigDecimal getEth() { 64 | return eth; 65 | } 66 | 67 | public BigDecimal getLtc() { 68 | return ltc; 69 | } 70 | 71 | public BigDecimal getEur() { 72 | return eur; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/entity/paxos/PaxosDay.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.entity.paxos; 17 | 18 | import com.fasterxml.jackson.annotation.JsonProperty; 19 | 20 | public class PaxosDay { 21 | private String high; 22 | private String low; 23 | private String open; 24 | private String volume; 25 | @JsonProperty("volume_weighted_average_price") 26 | private String volumeWeightedAveragePrice; 27 | @JsonProperty("last_execution") 28 | private String lastExecution; 29 | private PaxosTimeRange range; 30 | 31 | public String getHigh() { 32 | return high; 33 | } 34 | public void setHigh(String high) { 35 | this.high = high; 36 | } 37 | public String getLow() { 38 | return low; 39 | } 40 | public void setLow(String low) { 41 | this.low = low; 42 | } 43 | public String getOpen() { 44 | return open; 45 | } 46 | public void setOpen(String open) { 47 | this.open = open; 48 | } 49 | public String getVolume() { 50 | return volume; 51 | } 52 | public void setVolume(String volume) { 53 | this.volume = volume; 54 | } 55 | public String getVolumeWeightedAveragePrice() { 56 | return volumeWeightedAveragePrice; 57 | } 58 | public void setVolumeWeightedAveragePrice(String volumeWeightedAveragePrice) { 59 | this.volumeWeightedAveragePrice = volumeWeightedAveragePrice; 60 | } 61 | public PaxosTimeRange getRange() { 62 | return range; 63 | } 64 | public void setRange(PaxosTimeRange range) { 65 | this.range = range; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/entity/paxos/PaxosPrice.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.entity.paxos; 17 | 18 | public class PaxosPrice { 19 | private String price; 20 | private String amount; 21 | 22 | public String getPrice() { 23 | return price; 24 | } 25 | public void setPrice(String price) { 26 | this.price = price; 27 | } 28 | public String getAmount() { 29 | return amount; 30 | } 31 | public void setAmount(String amount) { 32 | this.amount = amount; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/entity/paxos/PaxosQuote.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.entity.paxos; 17 | 18 | import java.util.Date; 19 | 20 | import com.fasterxml.jackson.annotation.JsonProperty; 21 | 22 | public class PaxosQuote { 23 | private String market; 24 | @JsonProperty("best_bid") 25 | private PaxosPrice bestBid; 26 | @JsonProperty("best_ask") 27 | private PaxosPrice bestAsk; 28 | @JsonProperty("last_execution") 29 | private PaxosPrice lastExecution; 30 | private PaxosDay today; 31 | @JsonProperty("last_day") 32 | private PaxosDay lastDay; 33 | @JsonProperty("snapshot_at") 34 | private Date snapshotAt; 35 | 36 | public String getMarket() { 37 | return market; 38 | } 39 | public void setMarket(String market) { 40 | this.market = market; 41 | } 42 | public PaxosPrice getBestBid() { 43 | return bestBid; 44 | } 45 | public void setBestBid(PaxosPrice bestBid) { 46 | this.bestBid = bestBid; 47 | } 48 | public PaxosPrice getBestAsk() { 49 | return bestAsk; 50 | } 51 | public void setBestAsk(PaxosPrice bestAsk) { 52 | this.bestAsk = bestAsk; 53 | } 54 | public PaxosPrice getLastExecution() { 55 | return lastExecution; 56 | } 57 | public void setLastExecution(PaxosPrice lastExecution) { 58 | this.lastExecution = lastExecution; 59 | } 60 | public PaxosDay getToday() { 61 | return today; 62 | } 63 | public void setToday(PaxosDay today) { 64 | this.today = today; 65 | } 66 | public PaxosDay getLastDay() { 67 | return lastDay; 68 | } 69 | public void setLastDay(PaxosDay lastDay) { 70 | this.lastDay = lastDay; 71 | } 72 | public Date getSnapshotAt() { 73 | return snapshotAt; 74 | } 75 | public void setSnapshotAt(Date snapshotAt) { 76 | this.snapshotAt = snapshotAt; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/model/entity/paxos/PaxosTimeRange.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.model.entity.paxos; 17 | 18 | import java.util.Date; 19 | 20 | public class PaxosTimeRange { 21 | private Date begin; 22 | private Date end; 23 | 24 | public Date getBegin() { 25 | return begin; 26 | } 27 | public void setBegin(Date begin) { 28 | this.begin = begin; 29 | } 30 | public Date getEnd() { 31 | return end; 32 | } 33 | public void setEnd(Date end) { 34 | this.end = end; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/services/MyEventProducer.java: -------------------------------------------------------------------------------- 1 | package ch.xxx.trader.domain.services; 2 | 3 | import ch.xxx.trader.domain.model.entity.MyUser; 4 | import ch.xxx.trader.domain.model.entity.RevokedToken; 5 | import reactor.core.publisher.Mono; 6 | 7 | public interface MyEventProducer { 8 | Mono sendNewUser(MyUser dto); 9 | Mono sendUserLogout(RevokedToken dto); 10 | } 11 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/services/MyOrderBookClient.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.services; 17 | 18 | import reactor.core.publisher.Mono; 19 | 20 | public interface MyOrderBookClient { 21 | Mono getOrderbookBitfinex(String currpair); 22 | Mono getOrderbookBitstamp(String currpair); 23 | Mono getOrderbookItbit(String currpair); 24 | } 25 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/domain/services/MyUserService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.domain.services; 17 | 18 | import java.security.NoSuchAlgorithmException; 19 | import java.security.spec.InvalidKeySpecException; 20 | import java.util.Map; 21 | 22 | import ch.xxx.trader.domain.model.dto.AuthCheck; 23 | import ch.xxx.trader.domain.model.dto.RefreshTokenDto; 24 | import ch.xxx.trader.domain.model.entity.MyUser; 25 | import reactor.core.publisher.Mono; 26 | 27 | public interface MyUserService { 28 | void updateLoggedOutUsers(); 29 | Mono postAuthorize(AuthCheck authcheck, Map header); 30 | Mono postUserSignin(MyUser myUser); 31 | Mono postLogout(String bearerStr); 32 | Mono postUserLogin(MyUser myUser) throws NoSuchAlgorithmException, InvalidKeySpecException; 33 | Mono refreshToken(String bearerStr); 34 | } 35 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/usecase/common/LastlogoutTimestampExtractor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Sven Loesekann 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | package ch.xxx.trader.usecase.common; 14 | 15 | import java.sql.Timestamp; 16 | 17 | import org.apache.kafka.clients.consumer.ConsumerRecord; 18 | import org.apache.kafka.streams.processor.TimestampExtractor; 19 | import org.slf4j.Logger; 20 | import org.slf4j.LoggerFactory; 21 | 22 | import ch.xxx.trader.domain.model.entity.RevokedToken; 23 | 24 | public class LastlogoutTimestampExtractor implements TimestampExtractor { 25 | private static final Logger LOGGER = LoggerFactory.getLogger(LastlogoutTimestampExtractor.class); 26 | 27 | @Override 28 | public long extract(ConsumerRecord record, long partitionTime) { 29 | RevokedToken revokedToken = DtoUtils.produceObjectMapper().convertValue(record.value(), RevokedToken.class); 30 | // LOGGER.info(revokedToken.toString()); 31 | return Timestamp.valueOf(revokedToken.getLastLogout()).getTime(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/usecase/mappers/EventMapper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.usecase.mappers; 17 | 18 | import java.util.Optional; 19 | 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | import org.springframework.stereotype.Service; 23 | 24 | import com.fasterxml.jackson.core.JsonProcessingException; 25 | import com.fasterxml.jackson.databind.ObjectMapper; 26 | 27 | @Service 28 | public class EventMapper { 29 | private static final Logger LOG = LoggerFactory.getLogger(EventMapper.class); 30 | private final ObjectMapper objectMapper; 31 | 32 | public EventMapper(ObjectMapper objectMapper) { 33 | this.objectMapper = objectMapper; 34 | } 35 | 36 | public String mapDtoToString(Object dto) { 37 | String dtoJson; 38 | try { 39 | dtoJson = this.objectMapper.writeValueAsString(dto); 40 | } catch (JsonProcessingException e) { 41 | throw new RuntimeException(e); 42 | } 43 | return dtoJson; 44 | } 45 | 46 | public Optional mapJsonToObject(String jsonString, Class myClass) { 47 | Optional resultOpt; 48 | try { 49 | resultOpt = Optional.ofNullable(this.objectMapper.readValue(jsonString, myClass)); 50 | } catch (Exception e) { 51 | LOG.warn(String.format("Failed to deserialize %s", jsonString), e); 52 | resultOpt = Optional.empty(); 53 | } 54 | return resultOpt; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/usecase/mappers/ReportMapper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.usecase.mappers; 17 | 18 | import org.springframework.stereotype.Service; 19 | 20 | import ch.xxx.trader.domain.model.dto.QuotePdf; 21 | import ch.xxx.trader.domain.model.entity.QuoteBf; 22 | import ch.xxx.trader.domain.model.entity.QuoteBs; 23 | import ch.xxx.trader.domain.model.entity.QuoteIb; 24 | 25 | @Service 26 | public class ReportMapper { 27 | 28 | public QuotePdf convert(QuoteIb quote) { 29 | QuotePdf quotePdf = new QuotePdf(quote.getLastPrice(), quote.getPair(), quote.getVolume24h(), 30 | quote.getCreatedAt(), quote.getBid(), quote.getAsk()); 31 | return quotePdf; 32 | } 33 | 34 | public QuotePdf convert(QuoteBs quote) { 35 | QuotePdf quotePdf = new QuotePdf(quote.getLast(), quote.getPair(), quote.getVolume(), quote.getCreatedAt(), 36 | quote.getBid(), quote.getAsk()); 37 | return quotePdf; 38 | } 39 | 40 | public QuotePdf convert(QuoteBf quote) { 41 | QuotePdf quotePdf = new QuotePdf(quote.getLast_price(), quote.getPair(), quote.getVolume(), quote.getCreatedAt(), quote.getBid(), quote.getAsk()); 42 | return quotePdf; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /backend/src/main/java/ch/xxx/trader/usecase/services/MyUserServiceDb.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader.usecase.services; 17 | 18 | import org.slf4j.Logger; 19 | import org.slf4j.LoggerFactory; 20 | import org.springframework.context.annotation.Profile; 21 | import org.springframework.security.crypto.password.PasswordEncoder; 22 | import org.springframework.stereotype.Service; 23 | 24 | import ch.xxx.trader.domain.common.PasswordEncryption; 25 | import ch.xxx.trader.domain.model.entity.MyMongoRepository; 26 | import ch.xxx.trader.domain.model.entity.MyUser; 27 | import ch.xxx.trader.domain.services.MyUserService; 28 | import reactor.core.publisher.Mono; 29 | 30 | @Profile("!kafka & !prod") 31 | @Service 32 | public class MyUserServiceDb extends MyUserServiceBean implements MyUserService { 33 | private static final Logger LOGGER = LoggerFactory.getLogger(MyUserServiceDb.class); 34 | 35 | public MyUserServiceDb(JwtTokenService jwtTokenProvider, PasswordEncoder passwordEncoder, 36 | PasswordEncryption passwordEncryption, MyMongoRepository myMongoRepository) { 37 | super(jwtTokenProvider, passwordEncoder, passwordEncryption, myMongoRepository); 38 | } 39 | 40 | @Override 41 | public Mono postUserSignin(MyUser myUser) { 42 | return super.postUserSignin(myUser, true, true); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /backend/src/main/java/org/apache/kafka/clients/DefaultHostResolver.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Sven Loesekann 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | package org.apache.kafka.clients; 14 | 15 | import java.net.InetAddress; 16 | import java.net.UnknownHostException; 17 | 18 | public class DefaultHostResolver implements HostResolver { 19 | public static volatile String IP_ADDRESS = ""; 20 | public static volatile String KAFKA_SERVER_NAME = ""; 21 | public static volatile String KAFKA_SERVICE_NAME = ""; 22 | 23 | @Override 24 | public InetAddress[] resolve(String host) throws UnknownHostException { 25 | if(host.startsWith(KAFKA_SERVER_NAME) && !IP_ADDRESS.isBlank()) { 26 | InetAddress[] addressArr = new InetAddress[1]; 27 | addressArr[0] = InetAddress.getByAddress(host, InetAddress.getByName(IP_ADDRESS).getAddress()); 28 | return addressArr; 29 | } else if(host.startsWith(KAFKA_SERVER_NAME) && !KAFKA_SERVICE_NAME.isBlank()) { 30 | host = KAFKA_SERVICE_NAME; 31 | } 32 | return InetAddress.getAllByName(host); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /backend/src/main/resources/.gitignore: -------------------------------------------------------------------------------- 1 | /static/ 2 | -------------------------------------------------------------------------------- /backend/src/main/resources/application-kafka.properties: -------------------------------------------------------------------------------- 1 | kafka.server.name=${KAFKA_SERVER_NAME:localhost} 2 | spring.kafka.bootstrap-servers=localhost:9092 3 | spring.kafka.producer.compression-type=gzip 4 | spring.kafka.producer.transaction-id-prefix: tx- 5 | spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer 6 | spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer 7 | spring.kafka.producer.enable.idempotence=true 8 | spring.kafka.consumer.group-id=group_id 9 | spring.kafka.consumer.auto-offset-reset=earliest 10 | spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer 11 | spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer 12 | spring.kafka.consumer.enable-auto-commit=false 13 | spring.kafka.consumer.isolation-level=read_committed 14 | spring.kafka.consumer.transaction-id-prefix: tx- 15 | spring.kafka.streams.properties.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde 16 | spring.kafka.streams.properties.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde 17 | spring.kafka.streams.application-id=angular-and-spring -------------------------------------------------------------------------------- /backend/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | kafka.server.name=${KAFKA_SERVER_NAME:kafkaapp} 2 | spring.kafka.bootstrap-servers=${KAFKA_SERVICE_NAME}:9092 3 | spring.kafka.producer.compression-type=gzip 4 | spring.kafka.producer.transaction-id-prefix: tx- 5 | spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer 6 | spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer 7 | spring.kafka.producer.enable.idempotence=true 8 | spring.kafka.consumer.group-id=group_id 9 | spring.kafka.consumer.auto-offset-reset=earliest 10 | spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer 11 | spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer 12 | spring.kafka.consumer.enable-auto-commit=false 13 | spring.kafka.consumer.isolation-level=read_committed 14 | spring.kafka.consumer.transaction-id-prefix: tx- 15 | spring.kafka.streams.properties.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde 16 | spring.kafka.streams.properties.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde 17 | spring.kafka.streams.application-id=angular-and-spring -------------------------------------------------------------------------------- /backend/src/main/resources/log4j.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /backend/src/test/java/ch/xxx/trader/PasswordEncryptionTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.trader; 17 | 18 | import java.security.NoSuchAlgorithmException; 19 | import java.security.spec.InvalidKeySpecException; 20 | 21 | import org.junit.jupiter.api.Assertions; 22 | import org.junit.jupiter.api.Test; 23 | 24 | import ch.xxx.trader.domain.common.PasswordEncryption; 25 | 26 | 27 | 28 | public class PasswordEncryptionTest { 29 | PasswordEncryption pe = new PasswordEncryption(); 30 | 31 | @Test 32 | public void abcEncryption() throws NoSuchAlgorithmException, InvalidKeySpecException { 33 | String salt = pe.generateSalt(); 34 | String encryptedPassword = pe.getEncryptedPassword("abc", salt); 35 | Assertions.assertTrue(pe.authenticate("abc", encryptedPassword, salt)); 36 | } 37 | 38 | @Test 39 | public void strNumEncryption() throws NoSuchAlgorithmException, InvalidKeySpecException { 40 | String salt = pe.generateSalt(); 41 | String encryptedPassword = pe.getEncryptedPassword("abc123", salt); 42 | Assertions.assertTrue(pe.authenticate("abc123", encryptedPassword, salt)); 43 | } 44 | 45 | @Test 46 | public void realPwdEncryption() throws NoSuchAlgorithmException, InvalidKeySpecException { 47 | String salt = pe.generateSalt(); 48 | String encryptedPassword = pe.getEncryptedPassword("abc123%&/?!", salt); 49 | Assertions.assertTrue(pe.authenticate("abc123%&/?!", encryptedPassword, salt)); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /backend/src/test/java/ch/xxx/trader/RandomNumberTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Sven Loesekann 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | package ch.xxx.trader; 14 | 15 | import java.nio.ByteBuffer; 16 | import java.util.Base64; 17 | import java.util.Random; 18 | 19 | import org.junit.jupiter.api.Assertions; 20 | import org.junit.jupiter.api.Test; 21 | 22 | public class RandomNumberTest { 23 | private Random rand = new Random(); 24 | 25 | @Test 26 | public void generateRandomNumber() { 27 | Assertions.assertNotNull(rand.nextLong()); 28 | } 29 | 30 | // generates the bas64 encoded random number for the jwt signature 31 | // property: security.jwt.token.secret-key 32 | @Test 33 | public void generateBase64RandomNumber() { 34 | final int numberOfBytes = 32; 35 | ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES*numberOfBytes); 36 | for(int i = 0;i testStrings = List.of( 31 | "ch.xxx.trader.adapter.controller.StatisticsController__BeanDefinitions.class", 32 | "file:/home/sven/git/AngularAndSpring/backend/target/classes/ch/xxx/trader/TraderApplication$$SpringCGLIB$$0.class", 33 | "ch.xxx.maps.usecase.service.CompanySiteService__TestContext001_BeanDefinitions.class"); 34 | private final DoNotIncludeAotGenerated importOption = new MyArchitectureTests.DoNotIncludeAotGenerated(); 35 | 36 | @Test 37 | public void testMatcherBeanDefinition() throws URISyntaxException { 38 | Assertions.assertFalse(importOption.includes(Location.of(Path.of(testStrings.get(0))))); 39 | } 40 | 41 | @Test 42 | public void testMatcherCgLib() throws URISyntaxException { 43 | Assertions.assertFalse(importOption.includes(Location.of(Path.of(testStrings.get(1))))); 44 | } 45 | 46 | @Test 47 | public void testMatcherTests() throws URISyntaxException { 48 | Assertions.assertFalse(importOption.includes(Location.of(Path.of(testStrings.get(2))))); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /backend/src/test/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.data.mongodb.uri=mongodb://${MONGODB_HOST:localhost}:27017/test?connectTimeoutMS=3000&socketTimeoutMS=11000&wtimeoutMS=10000&serverSelectionTimeoutMS=5000&heartbeatFrequencyMS=5000&maxLifeTimeMS=25000 2 | kubernetes.pod.cpu.constraint=false -------------------------------------------------------------------------------- /buildDocker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #./mvnw clean install -Ddocker=true -Dnpm.test.script=test-chromium 3 | ./mvnw clean install -Ddocker=true 4 | docker build -t angular2guy/angularandspring:latest --build-arg JAR_FILE=angularandspring-backend-0.0.1-SNAPSHOT.jar --no-cache . 5 | docker run -p 8080:8080 --memory="512m" --cpus=1.0 --network="host" angular2guy/angularandspring:latest -------------------------------------------------------------------------------- /frontend/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /frontend/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | angularandspring-frontend 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /frontend/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /frontend/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=24 5 | org.eclipse.jdt.core.compiler.compliance=24 6 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 8 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 9 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 10 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 11 | org.eclipse.jdt.core.compiler.release=enabled 12 | org.eclipse.jdt.core.compiler.source=24 13 | -------------------------------------------------------------------------------- /frontend/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /frontend/src/angular/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /frontend/src/angular/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "ignorePatterns": [ 4 | "projects/**/*" 5 | ], 6 | "overrides": [ 7 | { 8 | "files": [ 9 | "*.ts" 10 | ], 11 | "parserOptions": { 12 | "project": [ 13 | "tsconfig.json", 14 | "e2e/tsconfig.json" 15 | ], 16 | "createDefaultProgram": true 17 | }, 18 | "extends": [ 19 | "plugin:@angular-eslint/ng-cli-compat", 20 | "plugin:@angular-eslint/ng-cli-compat--formatting-add-on", 21 | "plugin:@angular-eslint/template/process-inline-templates" 22 | ], 23 | "rules": { 24 | "@angular-eslint/component-selector": [ 25 | "error", 26 | { 27 | "type": "element", 28 | "prefix": "app", 29 | "style": "kebab-case" 30 | } 31 | ], 32 | "@angular-eslint/directive-selector": [ 33 | "error", 34 | { 35 | "type": "attribute", 36 | "prefix": "app", 37 | "style": "camelCase" 38 | } 39 | ], 40 | "@typescript-eslint/explicit-member-accessibility": [ 41 | "off", 42 | { 43 | "accessibility": "explicit" 44 | } 45 | ], 46 | "arrow-parens": [ 47 | "off", 48 | "always" 49 | ], 50 | "import/order": "off" 51 | } 52 | }, 53 | { 54 | "files": [ 55 | "*.html" 56 | ], 57 | "extends": [ 58 | "plugin:@angular-eslint/template/recommended" 59 | ], 60 | "rules": {} 61 | } 62 | ] 63 | } 64 | -------------------------------------------------------------------------------- /frontend/src/angular/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.angular/cache 29 | /.sass-cache 30 | /connect.lock 31 | /coverage 32 | /libpeerconnection.log 33 | npm-debug.log 34 | testem.log 35 | /typings 36 | 37 | # e2e 38 | /e2e/*.js 39 | /e2e/*.map 40 | 41 | # System Files 42 | .DS_Store 43 | Thumbs.db 44 | /.angular/ 45 | -------------------------------------------------------------------------------- /frontend/src/angular/README.md: -------------------------------------------------------------------------------- 1 | # Trader 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.4.1. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | Before running the tests make sure you are serving the app via `ng serve`. 25 | 26 | ## Further help 27 | 28 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 29 | -------------------------------------------------------------------------------- /frontend/src/angular/base/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | The languages german and english are supported: 11 | German 12 | English 13 | 14 | -------------------------------------------------------------------------------- /frontend/src/angular/browserslist: -------------------------------------------------------------------------------- 1 | last 2 Chrome version 2 | last 2 Firefox version 3 | last 2 Edge major versions 4 | last 2 Safari major version 5 | last 2 iOS major versions 6 | Firefox ESR 7 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the `not` prefix on this line..<% } %> -------------------------------------------------------------------------------- /frontend/src/angular/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('trader App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /frontend/src/angular/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /frontend/src/angular/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /frontend/src/angular/i18n/messages.de.json: -------------------------------------------------------------------------------- 1 | { 2 | "locale": "de", 3 | "translations": { 4 | "bitfinex": "Bitfinex", 5 | "back": "Back", 6 | "last": "Last:", 7 | "high": "High:", 8 | "low": "Low:", 9 | "bid": "Bid:", 10 | "ask": "Ask:", 11 | "mid": "Mid:", 12 | "pair": "Pair:", 13 | "timestamp": "Timestamp:", 14 | "volume": "Volume:", 15 | "radioDays": "{VAR_PLURAL, plural, =1 {today} other {{INTERPOLATION} days}}", 16 | "linReg": "add Linear Reg", 17 | "showReport": "show report", 18 | "bitstamp": "Bitstamp", 19 | "open": "Open:", 20 | "vwap": "Vwap:", 21 | "coinbase": "Coinbase", 22 | "lastUsd": "Last Usd:", 23 | "lastEur": "Last Eur:", 24 | "lastYen": "Last Yen:", 25 | "lastGbp": "Last Pound:", 26 | "itbit": "Itbit", 27 | "orderbooks": "Orderbooks", 28 | "buy": "Buy", 29 | "sell": "Sell", 30 | "search": "Search", 31 | "orderbooksBitstampOrders": "Bitstamp Orders", 32 | "price": "Price", 33 | "amount": "Amount", 34 | "orderbooksItbitOrders": "Itbit Orders", 35 | "orderbooksBitfinexOrders": "Bitfinex Orders", 36 | "loginLogin": "Login", 37 | "loginUsername": "Username", 38 | "loginPassword": "Password", 39 | "loginLoginFailed": " Login Failed ", 40 | "ok": "Ok", 41 | "cancel": "Cancel", 42 | "loginSignin": "Signin", 43 | "loginEmail": "Email", 44 | "loginSigninFailed": " Signin Failed ", 45 | "loginWaiting": "Waiting...", 46 | "quoteOverviewCurrencyTable": "Curreny Table", 47 | "quoteOverviewStatistics": "Statistics", 48 | "quoteOverviewOrderbooks": "Orderbooks", 49 | "quoteOverviewLogin": "Login", 50 | "quoteOverviewLogout": "Logout", 51 | "quoteOverviewExchange": " Exchange ", 52 | "quoteOverviewCurrencyPair": " Currency Pair ", 53 | "quoteOverviewLast": " Last ", 54 | "quoteOverviewHigh": "High", 55 | "quoteOverviewLow": "Low", 56 | "quoteOverviewVolume": " Volume ", 57 | "splashWelcome": "Willkommen bei AngularAndSpring", 58 | "bitcoin": "Bitcoin", 59 | "ether": "Ether", 60 | "litecoin": "Litecoin", 61 | "ripple": "Ripple", 62 | "statisticsDuration": "Duration", 63 | "statisticsPerformance": "Performance", 64 | "statisticsVolatility": "Volatility", 65 | "statisticsAvgVolume": "Avg. Volume", 66 | "statisticsRangeMin": "Range Min", 67 | "statisticsRangeMax": "Range Max", 68 | "Month1": "1 Month", 69 | "Month3": "3 Months", 70 | "Month6": "6 Months", 71 | "Year1": "1 Year", 72 | "Year2": "2 Years", 73 | "Year5": "5 Years", 74 | "statistics": "Statistics" 75 | } 76 | } -------------------------------------------------------------------------------- /frontend/src/angular/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma'), 14 | require('karma-junit-reporter') 15 | ], 16 | client: { 17 | clearContext: false // leave Jasmine Spec Runner output visible in browser 18 | }, 19 | coverageIstanbulReporter: { 20 | dir: require('path').join(__dirname, '../coverage'), 21 | reports: ['html', 'lcovonly'], 22 | fixWebpackSourcePaths: true 23 | }, 24 | // reporters: ['progress', 'kjhtml', 'junit'], 25 | reporters: ['progress', 'kjhtml'], 26 | junitReporter: { 27 | outputDir: 'reports', // results will be saved as $outputDir/$browserName.xml 28 | outputFile: 'junit.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile 29 | useBrowserName: false // add browser name to report and classes names 30 | }, 31 | port: 9876, 32 | colors: true, 33 | logLevel: config.LOG_INFO, 34 | autoWatch: true, 35 | browsers: ['Chromium', 'ChromeHeadless', 'ChromiumHeadless'], 36 | customLaunchers: { 37 | ChromeHeadless: { 38 | base: 'Chrome', 39 | flags: ['--no-sandbox','--headless', '--disable-gpu', '--remote-debugging-port=9222'] 40 | }, 41 | ChromiumHeadless: { 42 | base: 'Chromium', 43 | flags: ['--no-sandbox','--headless', '--disable-gpu', '--remote-debugging-port=9222'] 44 | } 45 | }, 46 | singleRun: false, 47 | restartOnFileChange: true 48 | }); 49 | }; -------------------------------------------------------------------------------- /frontend/src/angular/proxy.conf.js: -------------------------------------------------------------------------------- 1 | const PROXY_CONFIG = [ 2 | { 3 | context: [ 4 | "/bitstamp", 5 | "/coinbase", 6 | "/itbit", 7 | "/bitfinex", 8 | "/myuser", 9 | "/statistics" 10 | ], 11 | target: "http://localhost:8080", 12 | secure: false 13 | } 14 | ] 15 | 16 | module.exports = PROXY_CONFIG; -------------------------------------------------------------------------------- /frontend/src/angular/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | /*** Copyright 2016 Sven Loesekann 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | import { NgModule } from "@angular/core"; 16 | import { Routes, RouterModule, PreloadAllModules } from "@angular/router"; 17 | import { AuthGuardService } from "./services/auth-guard.service"; 18 | import { SplashComponent } from "./splash/splash.component"; 19 | 20 | const routes: Routes = [ 21 | { 22 | path: "overview", 23 | loadChildren: () => 24 | import("./overview/overview.module").then((m) => m.OverviewModule), 25 | }, 26 | { 27 | path: "details", 28 | loadChildren: () => 29 | import("./details/details.module").then((m) => m.DetailsModule), 30 | }, 31 | { 32 | path: "orderbooks", 33 | loadChildren: () => 34 | import("./orderbooks/orderbooks.module").then((m) => m.OrderbooksModule), 35 | canActivate: [AuthGuardService], 36 | }, 37 | { 38 | path: "statistics", 39 | loadChildren: () => 40 | import("./statistics/statistics.module").then((m) => m.StatisticsModule), 41 | }, 42 | { path: "**", component: SplashComponent }, 43 | ]; 44 | 45 | @NgModule({ 46 | imports: [ 47 | RouterModule.forRoot(routes, { 48 | enableTracing: false, 49 | preloadingStrategy: PreloadAllModules, 50 | }), 51 | ], 52 | exports: [RouterModule], 53 | }) 54 | export class AppRoutingModule {} 55 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/AngularAndSpring/a61ec971a07ea31b3861915b81694d4f20d3ac1b/frontend/src/angular/src/app/app.component.scss -------------------------------------------------------------------------------- /frontend/src/angular/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { TestBed, waitForAsync } from "@angular/core/testing"; 17 | import { RouterTestingModule } from "@angular/router/testing"; 18 | import { AppComponent } from "./app.component"; 19 | describe("AppComponent", () => { 20 | // beforeEach(async(() => { 21 | // TestBed.configureTestingModule({ 22 | // imports: [ 23 | // RouterTestingModule 24 | // ], 25 | // declarations: [ 26 | // AppComponent 27 | // ], 28 | // }).compileComponents(); 29 | // })); 30 | // it('should create the app', async(() => { 31 | // const fixture = TestBed.createComponent(AppComponent); 32 | // const app = fixture.debugElement.componentInstance; 33 | // expect(app).toBeTruthy(); 34 | // })); 35 | // it(`should have as title 'app'`, async(() => { 36 | // const fixture = TestBed.createComponent(AppComponent); 37 | // const app = fixture.debugElement.componentInstance; 38 | // expect(app.title).toEqual('app'); 39 | // })); 40 | // it('should render title in a h1 tag', async(() => { 41 | // const fixture = TestBed.createComponent(AppComponent); 42 | // fixture.detectChanges(); 43 | // const compiled = fixture.debugElement.nativeElement; 44 | // expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); 45 | // })); 46 | it("should calc correctly", () => { 47 | expect(1 + 1).toEqual(2); 48 | }); 49 | }); 50 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { Component, Inject, LOCALE_ID, OnInit } from "@angular/core"; 17 | import { environment } from "./../environments/environment"; 18 | 19 | @Component({ 20 | selector: "app-root", 21 | templateUrl: "./app.component.html", 22 | styleUrls: ["./app.component.scss"], 23 | standalone: false 24 | }) 25 | export class AppComponent implements OnInit { 26 | protected title = "app"; 27 | 28 | constructor(@Inject(LOCALE_ID) private locale: string) {} 29 | 30 | ngOnInit(): void { 31 | //console.log(window.location.href); 32 | //console.log(this.locale); 33 | if (environment.production && window.location.href.split("/").length > 3) { 34 | let urlStr = "/" + window.location.href.split("/").slice(3).join("/"); 35 | urlStr = 36 | urlStr.indexOf(`/${this.locale}/`) !== 0 37 | ? `/${this.locale}` + urlStr 38 | : urlStr; 39 | //console.log(urlStr); 40 | window.history.pushState({ foo: "bar" }, "", urlStr); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { BrowserModule } from "@angular/platform-browser"; 17 | import { NgModule } from "@angular/core"; 18 | import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; 19 | import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from "@angular/common/http"; 20 | 21 | import { AppRoutingModule } from "./app-routing.module"; 22 | import { AppComponent } from "./app.component"; 23 | import { SplashComponent } from "./splash/splash.component"; 24 | import { MatProgressSpinnerModule } from "@angular/material/progress-spinner"; 25 | import { 26 | NgxServiceModule, 27 | SimpleChartsConfig, 28 | } from "ngx-simple-charts/base-service"; 29 | 30 | @NgModule({ declarations: [AppComponent, SplashComponent], 31 | bootstrap: [AppComponent], imports: [BrowserModule, 32 | AppRoutingModule, 33 | BrowserAnimationsModule, 34 | MatProgressSpinnerModule, 35 | NgxServiceModule.forRoot({ 36 | tokenRefreshPath: "/myuser/refreshToken", 37 | logoutPath: "/myuser/logout", 38 | loginRoute: "/login", 39 | })], providers: [provideHttpClient(withInterceptorsFromDi())] }) 40 | export class AppModule {} 41 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/common/authcheck.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export class AuthCheck { 17 | createdAt: Date; 18 | hash: string; 19 | path: string; 20 | authorized: boolean; 21 | } 22 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/common/common-statistics.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export enum StatisticCurrencyPair { 17 | bcUsd = "BcUsd", 18 | ethUsd = "EthUsd", 19 | lcUsd = "LcUsd", 20 | rpUsd = "RpUsd", 21 | } 22 | 23 | export enum CoinExchange { 24 | bitfinex = "Bitfinex", 25 | bitstamp = "Bitstamp", 26 | } 27 | 28 | export class CommonStatistics { 29 | currPair: StatisticCurrencyPair; 30 | performance1Month: number; 31 | performance3Month: number; 32 | performance6Month: number; 33 | performance1Year: number; 34 | performance2Year: number; 35 | performance5Year: number; 36 | volatility1Month: number; 37 | volatility3Month: number; 38 | volatility6Month: number; 39 | volatility1Year: number; 40 | volatility2Year: number; 41 | volatility5Year: number; 42 | avgVolume1Month: number; 43 | avgVolume3Month: number; 44 | avgVolume6Month: number; 45 | avgVolume1Year: number; 46 | avgVolume2Year: number; 47 | avgVolume5Year: number; 48 | range1Month: RangeValues; 49 | range3Month: RangeValues; 50 | range6Month: RangeValues; 51 | range1Year: RangeValues; 52 | range2Year: RangeValues; 53 | range5Year: RangeValues; 54 | } 55 | 56 | export class RangeValues { 57 | min: number; 58 | max: number; 59 | } 60 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/common/my-user.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export class MyUser { 17 | _id: string; 18 | userId: string; 19 | password: string; 20 | salt: string; 21 | email: string; 22 | btcAmount: number; 23 | ethAmount: number; 24 | ltcAmount: number; 25 | xrpAmount: number; 26 | token: string; 27 | } 28 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/common/orderbook-bf.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export interface OrderbookBf { 17 | bids: OrderBf[]; 18 | asks: OrderBf[]; 19 | } 20 | 21 | export interface OrderBf { 22 | price: string; 23 | amount: string; 24 | timestamp: Date; 25 | } 26 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/common/orderbook-bs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export interface OrderbookBs { 17 | timestamp: Date; 18 | bids: string[][]; 19 | asks: string[][]; 20 | } 21 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/common/orderbook-ib.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export interface OrderbookIb { 17 | bids: string[][]; 18 | asks: string[][]; 19 | } 20 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/common/quote-bf.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export interface QuoteBf { 17 | _id: string; 18 | pair: string; 19 | createdAt: string; 20 | mid: number; 21 | bid: number; 22 | ask: number; 23 | // eslint-disable-next-line @typescript-eslint/naming-convention 24 | last_price: number; 25 | low: number; 26 | high: number; 27 | volume: number; 28 | timestamp: string; 29 | } 30 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/common/quote-bs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export interface QuoteBs { 17 | _id: string; 18 | pair: string; 19 | createdAt: string; 20 | high: number; 21 | last: number; 22 | timestamp: string; 23 | bid: number; 24 | vwap: number; 25 | volume: number; 26 | low: number; 27 | ask: number; 28 | open: number; 29 | } 30 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/common/quote-ib.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export interface QuoteIb { 17 | _id: string; 18 | createdAt: string; 19 | pair: string; 20 | bid: number; 21 | bidAmt: number; 22 | ask: number; 23 | askAmt: number; 24 | lastPrice: number; 25 | stAmt: number; 26 | volume24h: number; 27 | volumeToday: number; 28 | high24h: number; 29 | low24h: number; 30 | openToday: number; 31 | vwapToday: number; 32 | vwap24h: number; 33 | serverTimeUTC: string; 34 | } 35 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/details/bfdetail/bfdetail.component.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | td { 17 | width: 150px; 18 | } 19 | .radioGroup { 20 | //margin-left: 100px; 21 | } 22 | .radioButton { 23 | margin-left: 10px; 24 | } 25 | .chart-container { 26 | height: calc(100vh - 250px); 27 | width: 100%; 28 | } 29 | .example-fill-remaining-space { 30 | // This fills the remaining space, by using flexbox. 31 | // Every toolbar row uses a flexbox row layout. 32 | flex: 1 1 auto; 33 | } 34 | 35 | ::ng-deep .line-linear-reg { 36 | fill: none !important; 37 | stroke: #7cfc00 !important; 38 | stroke-width: 2 !important; 39 | } 40 | 41 | ::ng-deep .mdc-form-field > label { 42 | cursor: pointer; 43 | } 44 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/details/bsdetail/bsdetail.component.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | td { 17 | width: 150px; 18 | } 19 | .radioGroup { 20 | //margin-left: 100px; 21 | } 22 | .radioButton { 23 | margin-left: 10px; 24 | } 25 | .chart-container { 26 | height: calc(100vh - 250px); 27 | width: 100%; 28 | } 29 | .example-fill-remaining-space { 30 | // This fills the remaining space, by using flexbox. 31 | // Every toolbar row uses a flexbox row layout. 32 | flex: 1 1 auto; 33 | } 34 | ::ng-deep .line-linear-reg { 35 | fill: none !important; 36 | stroke: #7cfc00 !important; 37 | stroke-width: 2 !important; 38 | } 39 | ::ng-deep .mdc-form-field > label { 40 | cursor: pointer; 41 | } 42 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/details/cbdetail/cbdetail.component.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | td { 17 | width: 150px; 18 | } 19 | .radioGroup { 20 | //margin-left: 100px; 21 | } 22 | .radioButton { 23 | margin-left: 10px; 24 | } 25 | .chart-container { 26 | height: calc(100vh - 250px); 27 | width: 100%; 28 | } 29 | .example-fill-remaining-space { 30 | // This fills the remaining space, by using flexbox. 31 | // Every toolbar row uses a flexbox row layout. 32 | flex: 1 1 auto; 33 | } 34 | ::ng-deep .line-linear-reg { 35 | fill: none !important; 36 | stroke: #7cfc00 !important; 37 | stroke-width: 2 !important; 38 | } 39 | ::ng-deep .mdc-form-field > label { 40 | cursor: pointer; 41 | } 42 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/details/details-routing.module.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import { NgModule } from "@angular/core"; 18 | import { Routes, RouterModule } from "@angular/router"; 19 | import { BsdetailComponent } from "./bsdetail/bsdetail.component"; 20 | import { IbdetailComponent } from "./ibdetail/ibdetail.component"; 21 | import { CbdetailComponent } from "./cbdetail/cbdetail.component"; 22 | import { BfdetailComponent } from "./bfdetail/bfdetail.component"; 23 | 24 | const routes: Routes = [ 25 | { path: "bsdetail/:currpair", component: BsdetailComponent }, 26 | { path: "ibdetail/:currpair", component: IbdetailComponent }, 27 | { path: "cbdetail/:currpair", component: CbdetailComponent }, 28 | { path: "bfdetail/:currpair", component: BfdetailComponent }, 29 | ]; 30 | 31 | @NgModule({ 32 | imports: [RouterModule.forChild(routes)], 33 | exports: [RouterModule], 34 | }) 35 | export class DetailsRoutingModule {} 36 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/details/details.module.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import { NgModule } from "@angular/core"; 18 | import { CommonModule } from "@angular/common"; 19 | import { DetailsRoutingModule } from "./details-routing.module"; 20 | import { ReactiveFormsModule, FormsModule } from "@angular/forms"; 21 | import { IbdetailComponent } from "./ibdetail/ibdetail.component"; 22 | import { CbdetailComponent } from "./cbdetail/cbdetail.component"; 23 | import { BsdetailComponent } from "./bsdetail/bsdetail.component"; 24 | import { BfdetailComponent } from "./bfdetail/bfdetail.component"; 25 | import { MatButtonModule } from "@angular/material/button"; 26 | import { MatRadioModule } from "@angular/material/radio"; 27 | import { MatToolbarModule } from "@angular/material/toolbar"; 28 | import { NgxLineChartsModule } from "ngx-simple-charts/line"; 29 | import { MatCheckboxModule } from "@angular/material/checkbox"; 30 | 31 | @NgModule({ 32 | imports: [ 33 | CommonModule, 34 | FormsModule, 35 | ReactiveFormsModule, 36 | MatToolbarModule, 37 | MatCheckboxModule, 38 | MatRadioModule, 39 | MatButtonModule, 40 | DetailsRoutingModule, 41 | NgxLineChartsModule, 42 | ], 43 | declarations: [ 44 | IbdetailComponent, 45 | CbdetailComponent, 46 | BsdetailComponent, 47 | BfdetailComponent, 48 | ], 49 | }) 50 | export class DetailsModule {} 51 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/details/ibdetail/ibdetail.component.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | td { 17 | width: 150px; 18 | } 19 | .radioGroup { 20 | //margin-left: 100px; 21 | } 22 | .radioButton { 23 | margin-left: 10px; 24 | } 25 | .chart-container { 26 | height: calc(100vh - 250px); 27 | width: 100%; 28 | } 29 | .example-fill-remaining-space { 30 | // This fills the remaining space, by using flexbox. 31 | // Every toolbar row uses a flexbox row layout. 32 | flex: 1 1 auto; 33 | } 34 | ::ng-deep .line-linear-reg { 35 | fill: none !important; 36 | stroke: #7cfc00 !important; 37 | stroke-width: 2 !important; 38 | } 39 | ::ng-deep .mdc-form-field > label { 40 | cursor: pointer; 41 | } 42 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/orderbooks/orderbooks-routing.module.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { NgModule } from "@angular/core"; 17 | import { Routes, RouterModule } from "@angular/router"; 18 | import { OrderbooksComponent } from "./orderbooks/orderbooks.component"; 19 | 20 | const routes: Routes = [ 21 | { 22 | path: "", 23 | component: OrderbooksComponent, 24 | }, 25 | ]; 26 | 27 | @NgModule({ 28 | imports: [RouterModule.forChild(routes)], 29 | exports: [RouterModule], 30 | }) 31 | export class OrderbooksRoutingModule {} 32 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/orderbooks/orderbooks.module.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { NgModule } from "@angular/core"; 17 | import { CommonModule } from "@angular/common"; 18 | 19 | import { OrderbooksRoutingModule } from "./orderbooks-routing.module"; 20 | import { OrderbooksComponent } from "./orderbooks/orderbooks.component"; 21 | import { FormsModule, ReactiveFormsModule } from "@angular/forms"; 22 | import { MatButtonModule } from "@angular/material/button"; 23 | import { MatCheckboxModule } from "@angular/material/checkbox"; 24 | import { MatInputModule } from "@angular/material/input"; 25 | import { MatListModule } from "@angular/material/list"; 26 | import { MatRadioModule } from "@angular/material/radio"; 27 | import { MatSelectModule } from "@angular/material/select"; 28 | import { MatToolbarModule } from "@angular/material/toolbar"; 29 | 30 | @NgModule({ 31 | imports: [ 32 | CommonModule, 33 | FormsModule, 34 | ReactiveFormsModule, 35 | MatToolbarModule, 36 | MatSelectModule, 37 | MatRadioModule, 38 | MatInputModule, 39 | MatCheckboxModule, 40 | MatButtonModule, 41 | MatListModule, 42 | OrderbooksRoutingModule, 43 | ], 44 | declarations: [OrderbooksComponent], 45 | }) 46 | export class OrderbooksModule {} 47 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/orderbooks/orderbooks/orderbooks.component.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | .formatMs { 17 | margin-top: 25px; 18 | } 19 | 20 | .flexcontainer { 21 | display: flex; 22 | flex-wrap: wrap; 23 | flex-direction: row; 24 | justify-content: space-around; 25 | } 26 | 27 | .flexchild { 28 | //margin-left: 10px; 29 | } 30 | 31 | .example-fill-remaining-space { 32 | // This fills the remaining space, by using flexbox. 33 | // Every toolbar row uses a flexbox row layout. 34 | flex: 1 1 auto; 35 | } 36 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/orderbooks/orderbooks/orderbooks.component.spec.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; 17 | 18 | import { OrderbooksComponent } from "./orderbooks.component"; 19 | 20 | //describe('OrderbooksComponent', () => { 21 | // let component: OrderbooksComponent; 22 | // let fixture: ComponentFixture; 23 | // 24 | // beforeEach(async(() => { 25 | // TestBed.configureTestingModule({ 26 | // declarations: [ OrderbooksComponent ] 27 | // }) 28 | // .compileComponents(); 29 | // })); 30 | // 31 | // beforeEach(() => { 32 | // fixture = TestBed.createComponent(OrderbooksComponent); 33 | // component = fixture.componentInstance; 34 | // fixture.detectChanges(); 35 | // }); 36 | // 37 | // it('should create', () => { 38 | // expect(component).toBeTruthy(); 39 | // }); 40 | //}); 41 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/overview/login/login.component.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | ul { 17 | list-style-type: none; 18 | } 19 | 20 | .errorText { 21 | color: red; 22 | } 23 | 24 | .spinner-container { 25 | display: flex; 26 | justify-content: center; 27 | align-items: center; 28 | padding: 20px; 29 | } 30 | 31 | ::ng-deep { 32 | .cdk-overlay-backdrop-showing { 33 | backdrop-filter: blur(3px); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/overview/login/login.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; 17 | 18 | import { LoginComponent } from "./login.component"; 19 | 20 | //describe('LoginComponent', () => { 21 | // let component: LoginComponent; 22 | // let fixture: ComponentFixture; 23 | // 24 | // beforeEach(async(() => { 25 | // TestBed.configureTestingModule({ 26 | // declarations: [ LoginComponent ] 27 | // }) 28 | // .compileComponents(); 29 | // })); 30 | // 31 | // beforeEach(() => { 32 | // fixture = TestBed.createComponent(LoginComponent); 33 | // component = fixture.componentInstance; 34 | // fixture.detectChanges(); 35 | // }); 36 | // 37 | // it('should create', () => { 38 | // expect(component).toBeTruthy(); 39 | // }); 40 | //}); 41 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/overview/overview-routing.module.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { NgModule } from "@angular/core"; 17 | import { Routes, RouterModule } from "@angular/router"; 18 | import { QuoteoverviewComponent } from "./quoteoverview/quoteoverview.component"; 19 | 20 | const routes: Routes = [ 21 | { 22 | path: "", 23 | component: QuoteoverviewComponent, 24 | }, 25 | ]; 26 | 27 | @NgModule({ 28 | imports: [RouterModule.forChild(routes)], 29 | exports: [RouterModule], 30 | }) 31 | export class OverviewRoutingModule {} 32 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/overview/overview.module.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { NgModule } from "@angular/core"; 17 | import { CommonModule } from "@angular/common"; 18 | import { MatProgressSpinnerModule } from "@angular/material/progress-spinner"; 19 | import { MatButtonModule } from "@angular/material/button"; 20 | import { MatDialogModule } from "@angular/material/dialog"; 21 | import { MatFormFieldModule } from "@angular/material/form-field"; 22 | import { MatInputModule } from "@angular/material/input"; 23 | import { MatTableModule } from "@angular/material/table"; 24 | import { MatTabsModule } from "@angular/material/tabs"; 25 | import { MatToolbarModule } from "@angular/material/toolbar"; 26 | import { OverviewRoutingModule } from "./overview-routing.module"; 27 | import { LoginComponent } from "./login/login.component"; 28 | import { QuoteoverviewComponent } from "./quoteoverview/quoteoverview.component"; 29 | import { FormsModule, ReactiveFormsModule } from "@angular/forms"; 30 | import { LuxonDateModule } from "@angular/material-luxon-adapter"; 31 | 32 | @NgModule({ 33 | imports: [ 34 | CommonModule, 35 | OverviewRoutingModule, 36 | MatTableModule, 37 | MatToolbarModule, 38 | MatTabsModule, 39 | MatButtonModule, 40 | MatDialogModule, 41 | MatFormFieldModule, 42 | MatProgressSpinnerModule, 43 | MatInputModule, 44 | LuxonDateModule, 45 | FormsModule, 46 | ReactiveFormsModule, 47 | ], 48 | declarations: [LoginComponent, QuoteoverviewComponent], 49 | }) 50 | export class OverviewModule {} 51 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/overview/quoteoverview/quoteoverview.component.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | .popup { 17 | display: none; 18 | } 19 | 20 | .cell:hover { 21 | .popup { 22 | display: block; 23 | width: 160px; 24 | margin-top: 0px; 25 | margin-left: 100px; 26 | background: #ffffff; 27 | border-radius: 6px; 28 | padding: 8px 0; 29 | position: absolute; 30 | z-index: 1; 31 | color: green; 32 | border: solid 1px black; 33 | } 34 | color: green; 35 | cursor: pointer; 36 | } 37 | 38 | .cell-outdated { 39 | color: #34a8eb; 40 | &:hover { 41 | .popup { 42 | color: #34a8eb; 43 | } 44 | } 45 | } 46 | 47 | .example-container { 48 | display: flex; 49 | flex-direction: column; 50 | } 51 | 52 | .mat-mdc-table { 53 | overflow: auto; 54 | } 55 | 56 | .example-fill-remaining-space { 57 | // This fills the remaining space, by using flexbox. 58 | // Every toolbar row uses a flexbox row layout. 59 | flex: 1 1 auto; 60 | } 61 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/overview/quoteoverview/quoteoverview.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; 17 | 18 | import { QuoteoverviewComponent } from "./quoteoverview.component"; 19 | 20 | //describe('QuoteoverviewComponent', () => { 21 | // let component: QuoteoverviewComponent; 22 | // let fixture: ComponentFixture; 23 | // 24 | // beforeEach(async(() => { 25 | // TestBed.configureTestingModule({ 26 | // declarations: [ QuoteoverviewComponent ] 27 | // }) 28 | // .compileComponents(); 29 | // })); 30 | // 31 | // beforeEach(() => { 32 | // fixture = TestBed.createComponent(QuoteoverviewComponent); 33 | // component = fixture.componentInstance; 34 | // fixture.detectChanges(); 35 | // }); 36 | // 37 | // it('should create', () => { 38 | // expect(component).toBeTruthy(); 39 | // }); 40 | //}); 41 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/services/auth-guard.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { TestBed, inject } from "@angular/core/testing"; 17 | 18 | import { AuthGuardService } from "./auth-guard.service"; 19 | 20 | //describe('AuthGuardService', () => { 21 | // beforeEach(() => { 22 | // TestBed.configureTestingModule({ 23 | // providers: [AuthGuardService] 24 | // }); 25 | // }); 26 | // 27 | // it('should be created', inject([AuthGuardService], (service: AuthGuardService) => { 28 | // expect(service).toBeTruthy(); 29 | // })); 30 | //}); 31 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/services/auth-guard.service.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { Injectable } from "@angular/core"; 17 | import { ActivatedRouteSnapshot, RouterStateSnapshot } from "@angular/router"; 18 | import { Observable } from "rxjs"; 19 | import { catchError, map, tap } from "rxjs/operators"; 20 | import { MyuserService } from "./myuser.service"; 21 | import { TokenService } from "ngx-simple-charts/base-service"; 22 | 23 | @Injectable({ providedIn: "root" }) 24 | export class AuthGuardService { 25 | constructor(private tokenService: TokenService) {} 26 | 27 | canActivate( 28 | route: ActivatedRouteSnapshot, 29 | state: RouterStateSnapshot, 30 | ): boolean | Observable | Promise { 31 | return !!this.tokenService.token && !!this.tokenService.userId; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/services/bitfinex.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { TestBed, inject } from "@angular/core/testing"; 17 | 18 | import { BitfinexService } from "./bitfinex.service"; 19 | 20 | //describe('BitfinexService', () => { 21 | // beforeEach(() => { 22 | // TestBed.configureTestingModule({ 23 | // providers: [BitfinexService] 24 | // }); 25 | // }); 26 | // 27 | // it('should be created', inject([BitfinexService], (service: BitfinexService) => { 28 | // expect(service).toBeTruthy(); 29 | // })); 30 | //}); 31 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/services/bitstamp.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { TestBed, inject } from "@angular/core/testing"; 17 | 18 | import { BitstampService } from "./bitstamp.service"; 19 | 20 | //describe('BitstampserviceService', () => { 21 | // beforeEach(() => { 22 | // TestBed.configureTestingModule({ 23 | // providers: [BitstampService] 24 | // }); 25 | // }); 26 | // 27 | // it('should be created', inject([BitstampService], (service: BitstampService) => { 28 | // expect(service).toBeTruthy(); 29 | // })); 30 | //}); 31 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/services/coinbase.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { TestBed, inject } from "@angular/core/testing"; 17 | 18 | import { CoinbaseService } from "./coinbase.service"; 19 | 20 | //describe('CoinbaseService', () => { 21 | // beforeEach(() => { 22 | // TestBed.configureTestingModule({ 23 | // providers: [CoinbaseService] 24 | // }); 25 | // }); 26 | // 27 | // it('should be created', inject([CoinbaseService], (service: CoinbaseService) => { 28 | // expect(service).toBeTruthy(); 29 | // })); 30 | //}); 31 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/services/itbit.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { TestBed, inject } from "@angular/core/testing"; 17 | 18 | import { ItbitService } from "./itbit.service"; 19 | 20 | //describe('ItbitService', () => { 21 | // beforeEach(() => { 22 | // TestBed.configureTestingModule({ 23 | // providers: [ItbitService] 24 | // }); 25 | // }); 26 | // 27 | // it('should be created', inject([ItbitService], (service: ItbitService) => { 28 | // expect(service).toBeTruthy(); 29 | // })); 30 | //}); 31 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/services/myuser.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { TestBed, inject } from "@angular/core/testing"; 17 | 18 | import { MyuserService } from "./myuser.service"; 19 | 20 | //describe('MyuserService', () => { 21 | // beforeEach(() => { 22 | // TestBed.configureTestingModule({ 23 | // providers: [MyuserService] 24 | // }); 25 | // }); 26 | // 27 | // it('should be created', inject([MyuserService], (service: MyuserService) => { 28 | // expect(service).toBeTruthy(); 29 | // })); 30 | //}); 31 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/services/statistic.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { TestBed } from "@angular/core/testing"; 17 | 18 | import { StatisticService } from "./statistic.service"; 19 | 20 | /* 21 | describe('StatisticService', () => { 22 | let service: StatisticService; 23 | 24 | beforeEach(() => { 25 | TestBed.configureTestingModule({}); 26 | service = TestBed.inject(StatisticService); 27 | }); 28 | 29 | it('should be created', () => { 30 | expect(service).toBeTruthy(); 31 | }); 32 | }); 33 | */ 34 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/services/statistic.service.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { HttpClient } from "@angular/common/http"; 17 | import { Injectable } from "@angular/core"; 18 | import { Observable } from "rxjs"; 19 | import { 20 | CommonStatistics, 21 | StatisticCurrencyPair, 22 | CoinExchange, 23 | } from "../common/common-statistics"; 24 | import { Utils } from "./utils"; 25 | import { catchError } from "rxjs/operators"; 26 | 27 | @Injectable({ 28 | providedIn: "root", 29 | }) 30 | export class StatisticService { 31 | private readonly statistics = "/statistics"; 32 | private utils = new Utils(); 33 | 34 | constructor(private http: HttpClient) {} 35 | 36 | getCommonStatistics( 37 | currencypair: StatisticCurrencyPair, 38 | coinExchange: CoinExchange, 39 | ): Observable { 40 | return this.http 41 | .get( 42 | `${this.statistics}/overview/${coinExchange}/${currencypair}`, 43 | ) 44 | .pipe( 45 | catchError( 46 | this.utils.handleError("getCommonStatistics"), 47 | ), 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/services/utils.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { Observable, of } from "rxjs"; 17 | import { HttpHeaders } from "@angular/common/http"; 18 | 19 | export class Utils { 20 | get token(): string { 21 | return !localStorage.getItem("token") 22 | ? null 23 | : localStorage.getItem("token"); 24 | } 25 | 26 | public createTokenHeader(): HttpHeaders { 27 | let reqOptions = new HttpHeaders().set("Content-Type", "application/json"); 28 | if (this.token) { 29 | reqOptions = new HttpHeaders() 30 | .set("Content-Type", "application/json") 31 | .set("Authorization", "Bearer " + this.token); 32 | } 33 | return reqOptions; 34 | } 35 | 36 | public handleError(operation = "operation", result?: T) { 37 | return (error: any): Observable => { 38 | // TODO: send the error to remote logging infrastructure 39 | console.error(error); // log to console instead 40 | 41 | // TODO: better job of transforming error for user consumption 42 | this.log(`${operation} failed: ${error.message}`); 43 | 44 | // Let the app keep running by returning an empty result. 45 | return of(result as T); 46 | }; 47 | } 48 | 49 | /** Log a HeroService message with the MessageService */ 50 | private log(message: string) { 51 | console.log(message); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/splash/splash.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Welcome to AngularAndSpring 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/splash/splash.component.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | .container { 17 | display: flex; 18 | width: 100%; 19 | justify-content: center; 20 | align-content: center; 21 | } 22 | .content { 23 | margin-top: 50px; 24 | } 25 | .example-margin { 26 | margin: 0 10px; 27 | } 28 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/splash/splash.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; 17 | 18 | import { SplashComponent } from "./splash.component"; 19 | 20 | //describe('SplashComponent', () => { 21 | // let component: SplashComponent; 22 | // let fixture: ComponentFixture; 23 | // 24 | // beforeEach(async(() => { 25 | // TestBed.configureTestingModule({ 26 | // declarations: [ SplashComponent ] 27 | // }) 28 | // .compileComponents(); 29 | // })); 30 | // 31 | // beforeEach(() => { 32 | // fixture = TestBed.createComponent(SplashComponent); 33 | // component = fixture.componentInstance; 34 | // fixture.detectChanges(); 35 | // }); 36 | // 37 | // it('should create', () => { 38 | // expect(component).toBeTruthy(); 39 | // }); 40 | //}); 41 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/splash/splash.component.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { Component, OnInit, AfterViewInit } from "@angular/core"; 17 | import { Router } from "@angular/router"; 18 | import { 19 | trigger, 20 | state, 21 | animate, 22 | transition, 23 | style, 24 | } from "@angular/animations"; 25 | 26 | @Component({ 27 | selector: "app-splash", 28 | templateUrl: "./splash.component.html", 29 | styleUrls: ["./splash.component.scss"], 30 | animations: [ 31 | trigger("showSplash", [ 32 | state("true", style({ opacity: 1 })), 33 | state("false", style({ opacity: 0 })), 34 | transition("1 => 0", animate("750ms")), 35 | transition("0 => 1", animate("750ms")), 36 | ]), 37 | ], 38 | standalone: false 39 | }) 40 | export class SplashComponent implements OnInit, AfterViewInit { 41 | protected myState = false; 42 | 43 | constructor(private router: Router) {} 44 | 45 | ngOnInit() { 46 | this.router.navigateByUrl("overview"); 47 | } 48 | 49 | ngAfterViewInit(): void { 50 | setTimeout(() => (this.myState = true)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/statistics/statistic-details/statistic-details.component.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | .mat-mdc-radio-button ~ .mat-radio-button { 18 | margin-left: 32px; 19 | } 20 | 21 | .radio-wrapper { 22 | margin-top: 12px; 23 | display: flex; 24 | justify-content: center; 25 | } 26 | 27 | table { 28 | margin-top: 16px; 29 | width: 100%; 30 | } 31 | 32 | td, 33 | th { 34 | text-align: left; 35 | padding: 0 5px 0 5px; 36 | border-bottom: solid 1px rgba(0, 0, 0, 0.1); 37 | font-family: Roboto, "Helvetica Neue", sans-serif; 38 | font-size: 16px; 39 | font-weight: 500; 40 | color: rgba(0, 0, 0, 0.87); 41 | } 42 | 43 | th { 44 | font-weight: 600; 45 | } 46 | 47 | .chart-container { 48 | height: calc(100vh - 380px); 49 | width: 100%; 50 | } 51 | 52 | .center-div { 53 | display: flex; 54 | align-items: center; 55 | justify-content: center; 56 | width: 100%; 57 | height: calc(100vh - 380px); 58 | } 59 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/statistics/statistic-details/statistic-details.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { ComponentFixture, TestBed } from "@angular/core/testing"; 17 | 18 | import { StatisticDetailsComponent } from "./statistic-details.component"; 19 | 20 | /* 21 | describe('StatisticDetailsComponent', () => { 22 | let component: StatisticDetailsComponent; 23 | let fixture: ComponentFixture; 24 | 25 | beforeEach(async () => { 26 | await TestBed.configureTestingModule({ 27 | declarations: [ StatisticDetailsComponent ] 28 | }) 29 | .compileComponents(); 30 | 31 | fixture = TestBed.createComponent(StatisticDetailsComponent); 32 | component = fixture.componentInstance; 33 | fixture.detectChanges(); 34 | }); 35 | 36 | it('should create', () => { 37 | expect(component).toBeTruthy(); 38 | }); 39 | }); 40 | */ 41 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/statistics/statistics-routing.module.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { NgModule } from "@angular/core"; 17 | import { Routes, RouterModule } from "@angular/router"; 18 | import { StatisticsComponent } from "./statistics.component"; 19 | 20 | const routes: Routes = [ 21 | { 22 | path: "", 23 | component: StatisticsComponent, 24 | }, 25 | ]; 26 | 27 | @NgModule({ 28 | imports: [RouterModule.forChild(routes)], 29 | exports: [RouterModule], 30 | }) 31 | export class StatisticsRoutingModule {} 32 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/statistics/statistics.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Statistics 4 | 5 | 7 | Back 8 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/statistics/statistics.component.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | .mat-mdc-table { 18 | overflow: auto; 19 | } 20 | 21 | .example-fill-remaining-space { 22 | // This fills the remaining space, by using flexbox. 23 | // Every toolbar row uses a flexbox row layout. 24 | flex: 1 1 auto; 25 | } 26 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/statistics/statistics.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { ComponentFixture, TestBed } from "@angular/core/testing"; 17 | 18 | import { StatisticsComponent } from "./statistics.component"; 19 | 20 | /* 21 | describe('StatisticsComponent', () => { 22 | let component: StatisticsComponent; 23 | let fixture: ComponentFixture; 24 | 25 | beforeEach(async () => { 26 | await TestBed.configureTestingModule({ 27 | declarations: [ StatisticsComponent ] 28 | }) 29 | .compileComponents(); 30 | 31 | fixture = TestBed.createComponent(StatisticsComponent); 32 | component = fixture.componentInstance; 33 | fixture.detectChanges(); 34 | }); 35 | 36 | it('should create', () => { 37 | expect(component).toBeTruthy(); 38 | }); 39 | }); 40 | */ 41 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/statistics/statistics.component.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { Component, OnInit } from "@angular/core"; 17 | import { Router } from "@angular/router"; 18 | import { CoinExchange, CommonStatistics } from "../common/common-statistics"; 19 | 20 | @Component({ 21 | selector: "app-statistics", 22 | templateUrl: "./statistics.component.html", 23 | styleUrls: ["./statistics.component.scss"], 24 | standalone: false 25 | }) 26 | export class StatisticsComponent { 27 | protected commonStatistics = new CommonStatistics(); 28 | protected coinExchange = CoinExchange; 29 | protected tabIndex = 0; 30 | 31 | constructor(private router: Router) {} 32 | 33 | back(): void { 34 | this.router.navigate(["/"]); 35 | } 36 | 37 | onSelTabChange(event: any): void { 38 | this.tabIndex = event.index; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /frontend/src/angular/src/app/statistics/statistics.module.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { NgModule } from "@angular/core"; 17 | import { CommonModule } from "@angular/common"; 18 | import { StatisticsComponent } from "./statistics.component"; 19 | import { StatisticsRoutingModule } from "./statistics-routing.module"; 20 | import { MatToolbarModule } from "@angular/material/toolbar"; 21 | import { MatButtonModule } from "@angular/material/button"; 22 | import { MatTabsModule } from "@angular/material/tabs"; 23 | import { MatRadioModule } from "@angular/material/radio"; 24 | import { StatisticDetailsComponent } from "./statistic-details/statistic-details.component"; 25 | import { FormsModule, ReactiveFormsModule } from "@angular/forms"; 26 | import { NgxBarChartsModule } from "ngx-simple-charts/bar"; 27 | import { MatProgressSpinnerModule } from "@angular/material/progress-spinner"; 28 | 29 | @NgModule({ 30 | declarations: [StatisticsComponent, StatisticDetailsComponent], 31 | imports: [ 32 | CommonModule, 33 | FormsModule, 34 | ReactiveFormsModule, 35 | StatisticsRoutingModule, 36 | MatToolbarModule, 37 | MatButtonModule, 38 | MatTabsModule, 39 | MatRadioModule, 40 | NgxBarChartsModule, 41 | MatProgressSpinnerModule, 42 | ], 43 | }) 44 | export class StatisticsModule {} 45 | -------------------------------------------------------------------------------- /frontend/src/angular/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/AngularAndSpring/a61ec971a07ea31b3861915b81694d4f20d3ac1b/frontend/src/angular/src/assets/.gitkeep -------------------------------------------------------------------------------- /frontend/src/angular/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | }; 4 | -------------------------------------------------------------------------------- /frontend/src/angular/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false, 8 | }; 9 | -------------------------------------------------------------------------------- /frontend/src/angular/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/AngularAndSpring/a61ec971a07ea31b3861915b81694d4f20d3ac1b/frontend/src/angular/src/favicon.ico -------------------------------------------------------------------------------- /frontend/src/angular/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Trader 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /frontend/src/angular/src/main.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { enableProdMode } from "@angular/core"; 17 | import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; 18 | 19 | import { AppModule } from "./app/app.module"; 20 | import { environment } from "./environments/environment"; 21 | 22 | if (environment.production) { 23 | enableProdMode(); 24 | } 25 | 26 | platformBrowserDynamic() 27 | .bootstrapModule(AppModule) 28 | .catch((err) => console.log(err)); 29 | -------------------------------------------------------------------------------- /frontend/src/angular/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /*************************************************************************************************** 2 | * Load `$localize` onto the global scope - used if i18n tags appear in Angular templates. 3 | */ 4 | import "@angular/localize/init"; 5 | /** 6 | * This file includes polyfills needed by Angular and is loaded before the app. 7 | * You can add your own extra polyfills to this file. 8 | * 9 | * This file is divided into 2 sections: 10 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 11 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 12 | * file. 13 | * 14 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 15 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 16 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 17 | * 18 | * Learn more in https://angular.io/guide/browser-support 19 | */ 20 | 21 | /*************************************************************************************************** 22 | * BROWSER POLYFILLS 23 | */ 24 | 25 | /** 26 | * By default, zone.js will patch all possible macroTask and DomEvents 27 | * user can disable parts of macroTask/DomEvents patch by setting following flags 28 | * because those flags need to be set before `zone.js` being loaded, and webpack 29 | * will put import in the top of bundle, so user need to create a separate file 30 | * in this directory (for example: zone-flags.ts), and put the following flags 31 | * into that file, and then add the following code before importing zone.js. 32 | * import './zone-flags.ts'; 33 | * 34 | * The flags allowed in zone-flags.ts are listed here. 35 | * 36 | * The following flags will work for all browsers. 37 | * 38 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 39 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 40 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 41 | * 42 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 43 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 44 | * 45 | * (window as any).__Zone_enable_cross_context_check = true; 46 | * 47 | */ 48 | 49 | /*************************************************************************************************** 50 | * Zone JS is required by default for Angular itself. 51 | */ 52 | import "zone.js"; // Included with Angular CLI. 53 | 54 | /*************************************************************************************************** 55 | * APPLICATION IMPORTS 56 | */ 57 | -------------------------------------------------------------------------------- /frontend/src/angular/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | @use "material-icons/iconfont/material-icons.scss"; 4 | 5 | .detailLinks { 6 | margin-top: 10px; 7 | margin-bottom: 10px; 8 | } 9 | 10 | .currPair { 11 | padding-left: 10px; 12 | } 13 | -------------------------------------------------------------------------------- /frontend/src/angular/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import "zone.js/testing"; 4 | import { getTestBed } from "@angular/core/testing"; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting, 8 | } from "@angular/platform-browser-dynamic/testing"; 9 | 10 | // First, initialize the Angular testing environment. 11 | getTestBed().initTestEnvironment( 12 | BrowserDynamicTestingModule, 13 | platformBrowserDynamicTesting(), 14 | { 15 | teardown: { destroyAfterEach: false }, 16 | }, 17 | ); 18 | -------------------------------------------------------------------------------- /frontend/src/angular/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /frontend/src/angular/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "src/main.ts", 9 | "src/polyfills.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.d.ts" 13 | ] 14 | } -------------------------------------------------------------------------------- /frontend/src/angular/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "forceConsistentCasingInFileNames": true, 7 | "esModuleInterop": true, 8 | "noImplicitReturns": true, 9 | "noFallthroughCasesInSwitch": true, 10 | "sourceMap": true, 11 | "declaration": false, 12 | "experimentalDecorators": true, 13 | "module": "esnext", 14 | "moduleResolution": "bundler", 15 | "importHelpers": true, 16 | "target": "ES2022", 17 | "typeRoots": [ 18 | "node_modules/@types" 19 | ], 20 | "lib": [ 21 | "es2018", 22 | "dom" 23 | ], 24 | "useDefineForClassFields": false 25 | }, 26 | "angularCompilerOptions": { 27 | "strictTemplates": true, 28 | "fullTemplateTypeCheck": true, 29 | "strictInjectionParameters": true, 30 | "noImplicitAny": false 31 | } 32 | } -------------------------------------------------------------------------------- /frontend/src/angular/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } -------------------------------------------------------------------------------- /minikube/angularandspring/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | -------------------------------------------------------------------------------- /minikube/angularandspring/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | appVersion: "1.0" 3 | description: "AngularAndSpring Config" 4 | name: angularandspring 5 | version: 0.1.0 6 | icon: "https://angular.io/assets/images/logos/angular/angular.png" -------------------------------------------------------------------------------- /minikube/angularandspring/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* vim: set filetype=mustache: */}} 2 | {{/* 3 | Expand the name of the chart. 4 | */}} 5 | {{- define "helm-chart.name" -}} 6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 7 | {{- end -}} 8 | 9 | {{/* 10 | Create a default fully qualified app name. 11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 12 | If release name contains chart name it will be used as a full name. 13 | */}} 14 | {{- define "helm-chart.fullname" -}} 15 | {{- if .Values.fullnameOverride -}} 16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} 17 | {{- else -}} 18 | {{- $name := default .Chart.Name .Values.nameOverride -}} 19 | {{- if contains $name .Release.Name -}} 20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} 21 | {{- else -}} 22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 23 | {{- end -}} 24 | {{- end -}} 25 | {{- end -}} 26 | 27 | {{/* 28 | Create chart name and version as used by the chart label. 29 | */}} 30 | {{- define "helm-chart.chart" -}} 31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 32 | {{- end -}} 33 | 34 | {{/* 35 | Create envApp values 36 | */}} 37 | {{- define "helpers.list-envApp-variables"}} 38 | {{- $secretName := .Values.secret.name -}} 39 | {{- range $key, $val := .Values.envApp.secret }} 40 | - name: {{ $key }} 41 | valueFrom: 42 | secretKeyRef: 43 | name: {{ $secretName }} 44 | key: {{ $key }} 45 | {{- end}} 46 | {{- range $key, $val := .Values.envApp.normal }} 47 | - name: {{ $key }} 48 | value: {{ $val | quote }} 49 | {{- end}} 50 | {{- end }} -------------------------------------------------------------------------------- /minikube/angularandspring/values.yaml: -------------------------------------------------------------------------------- 1 | webAppName: angularandspring 2 | dbName: mongodb 3 | webImageName: angular2guy/angularandspring 4 | webImageVersion: latest 5 | dbImageName: mongo 6 | dbImageVersion: 4.4 7 | volumeClaimName: mongo-pv-claim 8 | persistentVolumeName: mongo-pv-volume 9 | 10 | secret: 11 | name: app-env-secret 12 | 13 | envApp: 14 | normal: 15 | MONGODB_HOST: mongodb 16 | CPU_CONSTRAINT: true 17 | SHUTDOWN_PHASE: 10s 18 | secret: 19 | JWTTOKEN_SECRET: secret-key1234567890abcdefghijklmnopqrstuvwxyz -------------------------------------------------------------------------------- /minikube/angularandspringwithkafka/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | -------------------------------------------------------------------------------- /minikube/angularandspringwithkafka/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | appVersion: "1.1" 3 | description: "AngularAndSpring with Kafka Config" 4 | name: angularandspringwithkafka 5 | version: 0.1.1 6 | icon: "https://angular.io/assets/images/logos/angular/angular.png" -------------------------------------------------------------------------------- /minikube/angularandspringwithkafka/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* vim: set filetype=mustache: */}} 2 | {{/* 3 | Expand the name of the chart. 4 | */}} 5 | {{- define "helm-chart.name" -}} 6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 7 | {{- end -}} 8 | 9 | {{/* 10 | Create a default fully qualified app name. 11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 12 | If release name contains chart name it will be used as a full name. 13 | */}} 14 | {{- define "helm-chart.fullname" -}} 15 | {{- if .Values.fullnameOverride -}} 16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} 17 | {{- else -}} 18 | {{- $name := default .Chart.Name .Values.nameOverride -}} 19 | {{- if contains $name .Release.Name -}} 20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} 21 | {{- else -}} 22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 23 | {{- end -}} 24 | {{- end -}} 25 | {{- end -}} 26 | 27 | {{/* 28 | Create chart name and version as used by the chart label. 29 | */}} 30 | {{- define "helm-chart.chart" -}} 31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 32 | {{- end -}} 33 | 34 | {{/* 35 | Create envApp values 36 | */}} 37 | {{- define "helpers.list-envApp-variables"}} 38 | {{- $secretName := .Values.secret.name -}} 39 | {{- range $key, $val := .Values.envApp.secret }} 40 | - name: {{ $key }} 41 | valueFrom: 42 | secretKeyRef: 43 | name: {{ $secretName }} 44 | key: {{ $key }} 45 | {{- end}} 46 | {{- range $key, $val := .Values.envApp.normal }} 47 | - name: {{ $key }} 48 | value: {{ $val | quote }} 49 | {{- end}} 50 | {{- end }} 51 | 52 | {{/* 53 | Create envKafka values 54 | */}} 55 | {{- define "helpers.list-envKafkaApp-variables"}} 56 | {{- $secretName := .Values.secret.nameKafka -}} 57 | {{- range $key, $val := .Values.envKafka.secret }} 58 | - name: {{ $key }} 59 | valueFrom: 60 | secretKeyRef: 61 | name: {{ $secretName }} 62 | key: {{ $key }} 63 | {{- end}} 64 | {{- range $key, $val := .Values.envKafka.normal }} 65 | - name: {{ $key }} 66 | value: {{ $val | quote }} 67 | {{- end}} 68 | {{- end }} -------------------------------------------------------------------------------- /minikube/angularandspringwithkafka/values.yaml: -------------------------------------------------------------------------------- 1 | webAppName: angularandspring 2 | dbName: mongodb 3 | webImageName: angular2guy/angularandspring 4 | webImageVersion: latest 5 | dbImageName: mongo 6 | dbImageVersion: 4.4 7 | volumeClaimName: mongo-pv-claim 8 | persistentVolumeName: mongo-pv-volume 9 | 10 | kafkaName: kafkaapp 11 | zookeeperName: zookeeperserver 12 | kafkaImageName: bitnami/kafka 13 | kafkaImageVersion: latest 14 | zookeeperImageName: bitnami/zookeeper 15 | zookeeperImageVersion: latest 16 | kafkaServiceName: kafkaservice 17 | zookeeperServiceName: zookeeperservice 18 | dbServiceName: mongodbservice 19 | webAppServiceName: angularandspringservice 20 | 21 | secret: 22 | name: app-env-secret 23 | nameKafka: kafka-env-secret 24 | 25 | envApp: 26 | normal: 27 | MONGODB_HOST: mongodbservice 28 | CPU_CONSTRAINT: true 29 | SPRING_PROFILES_ACTIVE: prod 30 | KAFKA_SERVICE_NAME: kafkaService 31 | secret: 32 | JWTTOKEN_SECRET: secret-key1234567890abcdefghijklmnopqrstuvwxyz 33 | 34 | envKafka: 35 | normal: 36 | KAFKA_CFG_NODE_ID: 0 37 | KAFKA_CFG_PROCESS_ROLES: controller,broker 38 | KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093 39 | KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT 40 | KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafkaservice:9093 41 | KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER 42 | -------------------------------------------------------------------------------- /minikube/helmCommand.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #helm install angularandspring ./angularandspring --set serviceType=NodePort 3 | #helm install kafka ./kafka 4 | #helm install angularandspringwithkafka ./angularandspringwithkafka -------------------------------------------------------------------------------- /minikube/kafka/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj -------------------------------------------------------------------------------- /minikube/kafka/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | appVersion: "1.0" 3 | description: Kafka Development Setup 4 | name: kafkadev 5 | version: 0.1.0 6 | icon: "https://angular.io/assets/images/logos/angular/angular.png" -------------------------------------------------------------------------------- /minikube/kafka/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* vim: set filetype=mustache: */}} 2 | {{/* 3 | Expand the name of the chart. 4 | */}} 5 | {{- define "helm-chart.name" -}} 6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 7 | {{- end -}} 8 | 9 | {{/* 10 | Create a default fully qualified app name. 11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 12 | If release name contains chart name it will be used as a full name. 13 | */}} 14 | {{- define "helm-chart.fullname" -}} 15 | {{- if .Values.fullnameOverride -}} 16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} 17 | {{- else -}} 18 | {{- $name := default .Chart.Name .Values.nameOverride -}} 19 | {{- if contains $name .Release.Name -}} 20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} 21 | {{- else -}} 22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 23 | {{- end -}} 24 | {{- end -}} 25 | {{- end -}} 26 | 27 | {{/* 28 | Create chart name and version as used by the chart label. 29 | */}} 30 | {{- define "helm-chart.chart" -}} 31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 32 | {{- end -}} 33 | 34 | {{/* 35 | Create envZookeeper values 36 | */}} 37 | {{- define "helpers.list-envZookeeperApp-variables"}} 38 | {{- $secretName := .Values.secret.nameZookeeper -}} 39 | {{- range $key, $val := .Values.envZookeeper.secret }} 40 | - name: {{ $key }} 41 | valueFrom: 42 | secretKeyRef: 43 | name: {{ $secretName }} 44 | key: {{ $key }} 45 | {{- end}} 46 | {{- range $key, $val := .Values.envZookeeper.normal }} 47 | - name: {{ $key }} 48 | value: {{ $val | quote }} 49 | {{- end}} 50 | {{- end }} 51 | 52 | {{/* 53 | Create envKafka values 54 | */}} 55 | {{- define "helpers.list-envKafkaApp-variables"}} 56 | {{- $secretName := .Values.secret.nameKafka -}} 57 | {{- range $key, $val := .Values.envKafka.secret }} 58 | - name: {{ $key }} 59 | valueFrom: 60 | secretKeyRef: 61 | name: {{ $secretName }} 62 | key: {{ $key }} 63 | {{- end}} 64 | {{- range $key, $val := .Values.envKafka.normal }} 65 | - name: {{ $key }} 66 | value: {{ $val | quote }} 67 | {{- end}} 68 | {{- end }} -------------------------------------------------------------------------------- /minikube/kafka/values.yaml: -------------------------------------------------------------------------------- 1 | kafkaName: kafkaapp 2 | zookeeperName: zookeeperserver 3 | kafkaImageName: bitnami/kafka 4 | kafkaImageVersion: latest 5 | zookeeperImageName: bitnami/zookeeper 6 | zookeeperImageVersion: latest 7 | kafkaServiceName: kafkaservice 8 | zookeeperServiceName: zookeeperservice 9 | volumeClaimName: mongo-pv-claim 10 | persistentVolumeName: mongo-pv-volume 11 | 12 | secret: 13 | name: app-env-secret 14 | nameKafka: kafka-env-secret 15 | nameZookeeper: zookeeper-env-secret 16 | 17 | envZookeeper: 18 | normal: 19 | ALLOW_ANONYMOUS_LOGIN: yes 20 | secret: 21 | ZOOKEEPER_TICK_TIME: "2000" 22 | 23 | envKafka: 24 | normal: 25 | KAFKA_BROKER_ID: "1" 26 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT 27 | KAFKA_CFG_LISTENERS: PLAINTEXT://:9092 28 | KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://:9092 29 | KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: false 30 | ALLOW_PLAINTEXT_LISTENER: yes 31 | KAFKA_ENABLE_KRAFT: false 32 | secret: 33 | KAFKA_ZOOKEEPER_CONNECT: "zookeeperservice:2181" -------------------------------------------------------------------------------- /minikube/minikubeSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # execute helmCommand.sh 3 | 4 | kubectl get services 5 | minikube ip 6 | http://:/ 7 | 8 | minikube config set memory 16384 9 | minikube config set cpu 2 10 | #minikube config set cpu 4 11 | minikube config set driver docker 12 | minikube addons list 13 | minikube addons enable metrics-server 14 | kubectl edit deployment -n kube-system metrics-server 15 | 16 | kubectl logs --previous 17 | kubectl exec --stdin --tty -- /bin/bash 18 | kubectl expose pod --port=27017 --type="NodePort" 19 | mongorestore -v --gzip mongodb://: 20 | 21 | minikube start --extra-config=apiserver.service-node-port-range=1024-65535 22 | 23 | minikube pause 24 | minikube unpause 25 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 4.0.0 10 | ch.xxx 11 | angularandspring 12 | 0.0.1-SNAPSHOT 13 | pom 14 | angularandspring 15 | Demo project for Spring Boot 16 | 17 | org.springframework.boot 18 | spring-boot-starter-parent 19 | 3.5.0 20 | 21 | 22 | 23 | 24 | UTF-8 25 | UTF-8 26 | 24 27 | angular2guy 28 | 29 | test 30 | 31 | 32 | 33 | Apache License, Version 2.0 34 | repo 35 | http://www.apache.org/licenses/LICENSE-2.0.html 36 | 37 | 38 | 39 | 40 | frontend 41 | backend 42 | 43 | -------------------------------------------------------------------------------- /prometheus-local.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 15s 3 | 4 | scrape_configs: 5 | - job_name: 'prometheus' 6 | scrape_interval: 5s 7 | 8 | static_configs: 9 | - targets: ['localhost:9090'] 10 | 11 | - job_name: 'spring-actuator' 12 | metrics_path: '/actuator/prometheus' 13 | scrape_interval: 5s 14 | static_configs: 15 | - targets: ['localhost:8080'] -------------------------------------------------------------------------------- /runDocker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | docker pull mongo:4.4 3 | docker run --name local-mongo -p 27017:27017 --cpus=2.0 --volume tmp/mongodb --memory=3g mongo:4.4 --wiredTigerCacheSizeGB 2.0 4 | docker run -p 8080:8080 --memory="1g" --network="host" angular2guy/angularandspring:latest -------------------------------------------------------------------------------- /runGrafana.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #docker pull grafana/grafana 3 | MYID=`id -u` 4 | #data will be stored in ~/tmp/data 5 | #mkdir ~/tmp/data 6 | MYDATA=echo ~/tmp/data 7 | docker run --user "$MYID" --volume "$MYID:$MYDATA" --network "host" grafana/grafana -------------------------------------------------------------------------------- /runKafka.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # network config for KRaft 3 | docker network create app-tier --driver bridge 4 | # Kafka with KRaft 5 | docker run -d \ 6 | -p 9092:9092 \ 7 | --name kafka-server \ 8 | --hostname kafka-server \ 9 | --network app-tier \ 10 | -e KAFKA_CFG_NODE_ID=0 \ 11 | -e KAFKA_CFG_PROCESS_ROLES=controller,broker \ 12 | -e KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 \ 13 | -e KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT \ 14 | -e KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-server:9093 \ 15 | -e KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER \ 16 | bitnami/kafka:latest 17 | # Start Kafka with KRaft 18 | docker start kafka-server -------------------------------------------------------------------------------- /runMongoDBDocker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | docker pull mongo:6.0 3 | docker run --name local-mongo -p 27017:27017 --cpus=2.0 --memory=3g mongo:4.4 --wiredTigerCacheSizeGB 2.0 4 | #docker run --name local-mongo -p 27017:27017 --cpus=1.0 --memory=2g -v :/data/db mongo:6.0 --wiredTigerCacheSizeGB 1.0 5 | #docker start local-mongo 6 | #docker stop local-mongo 7 | #docker exec -it local-mongo bash -------------------------------------------------------------------------------- /runPrometheus.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #docker pull prom/prometheus 3 | LOCALDIR=pwd 4 | docker run --network "host" -v "$LOCALDIR/prometheus-local.yml:/etc/prometheus/prometheus.yml" prom/prometheus -------------------------------------------------------------------------------- /runStructurizr.sh: -------------------------------------------------------------------------------- 1 | docker pull structurizr/lite 2 | docker run -it --rm -p 8080:8080 -v ~/git/AngularAndSpring/structurizr:/usr/local/structurizr structurizr/lite -------------------------------------------------------------------------------- /structurizr/.gitignore: -------------------------------------------------------------------------------- 1 | /workspace.json 2 | .structurizr/ --------------------------------------------------------------------------------