-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced separate server module and added order updates to orderstate
- Loading branch information
Showing
29 changed files
with
754 additions
and
618 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 17 additions & 4 deletions
21
...in/org/roboquant/jupyter/MetricsReport.kt → ...lin/org/roboquant/charts/MetricsReport.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 17 additions & 1 deletion
18
...rg/roboquant/jupyter/MetricsReportTest.kt → ...org/roboquant/charts/MetricsReportTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright 2020-2023 Neural Layer | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ https://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>roboquant-parent</artifactId> | ||
<groupId>org.roboquant</groupId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>roboquant-server</artifactId> | ||
<packaging>jar</packaging> | ||
<name>roboquant server</name> | ||
<description>server to run roboquant algorithmic trading strategies</description> | ||
|
||
<properties> | ||
<ktor_version>2.3.3</ktor_version> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.roboquant</groupId> | ||
<artifactId>roboquant</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-core-jvm</artifactId> | ||
<version>${ktor_version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-html-builder-jvm</artifactId> | ||
<version>${ktor_version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-content-negotiation-jvm</artifactId> | ||
<version>${ktor_version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-serialization-gson-jvm</artifactId> | ||
<version>${ktor_version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-host-common-jvm</artifactId> | ||
<version>${ktor_version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-auth-jvm</artifactId> | ||
<version>${ktor_version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-sessions-jvm</artifactId> | ||
<version>${ktor_version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-netty-jvm</artifactId> | ||
<version>${ktor_version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<version>${slf4j.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
33 changes: 33 additions & 0 deletions
33
roboquant-server/src/main/kotlin/org/roboquant/server/PausablePolicy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2020-2023 Neural Layer | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.roboquant.server | ||
|
||
import org.roboquant.brokers.Account | ||
import org.roboquant.feeds.Event | ||
import org.roboquant.orders.Order | ||
import org.roboquant.policies.Policy | ||
import org.roboquant.strategies.Signal | ||
|
||
internal class PausablePolicy(private val policy: Policy, var pause: Boolean = false) : Policy by policy { | ||
|
||
override fun act(signals: List<Signal>, account: Account, event: Event): List<Order> { | ||
// Still invoke the policy so any state can be updated if required. | ||
val orders = policy.act(signals, account, event) | ||
return if (pause) emptyList() else orders | ||
} | ||
|
||
} |
Oops, something went wrong.