Skip to content

Commit

Permalink
Fixed grammer and typos in doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Dekkers committed May 16, 2022
1 parent 0986fcb commit e62ad01
Show file tree
Hide file tree
Showing 82 changed files with 197 additions and 197 deletions.
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ Roboquant is distributed under the link:/LICENSE[Apache 2.0 License].
Roboquant also comes with live trading and paper trading capabilities. Using this is at your own risk and there are NO guarantees about the correct functioning of the software.

== Beta version
Roboquant is still a pre-1.0 release and bugs are for sure to be expected. Also expect API's to change without any notice. So keep this in mind when using it.
Roboquant is still a pre-1.0 release and bugs are for sure to be expected. Also expect APIs to change without any notice. So keep this in mind when using it.

PR are more than welcome, see also the link:/docs/CONTRIBUTING.adoc[Contribution Guide] document. If you're missing some features, just open an issue on GitHub. See also the link:/docs/TODO.adoc[todo documentation] for already identified backlog items if you look for something to work on.
2 changes: 1 addition & 1 deletion data/README.adoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Data in this directory and its sub directiries is used during unit testing.
Data in this directory and its subdirectories is used during unit testing.

NOTE: It is not meant for real back tests.
3 changes: 1 addition & 2 deletions docs/CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ Submit issues https://github.com/neurallayer/roboquant/issues[here].
** If the bug is in behavior, then explain what behavior you've expected and what you've got.
* When submitting a feature request:
** Explain why you need the feature — what's your use-case, what's your domain.
** Explaining the problem you face is more important than suggesting a solution.
Report your problem even if you don't have any proposed solution.
** Explaining the problem you face is more important than suggesting a solution. Report your problem even if you don't have any proposed solution.
** If there is an alternative way to do what you need, then show the code of the alternative.

== Submitting PRs
Expand Down
6 changes: 3 additions & 3 deletions docs/INSTALL.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ Roboquant uses Maven for the build process and assuming you already have this in
mvn build
----

The build and install is tested using JDK 17 runtime, however the generated libraries are targeted against JDK 11 in order to provide greater compatibilty for projects that still use older versions of the JDK.
The build and install is tested using JDK 17 runtime, however the generated libraries are targeted against JDK 11 in order to provide greater compatibility for projects that still use older versions of the JDK.

TIP: If you plan to make many changes and updates to the source code, checkout the https://github.com/apache/maven-mvnd[Maven Deamon] project that provides much faster builds.
TIP: If you plan to make many changes and updates to the source code, checkout the https://github.com/apache/maven-mvnd[Maven Daemon] project that provides much faster builds.

== Interactive Brokers
Unfortuatly we are not allowed to redistribute the Interactive Brokers Java client, so you'll have to download the TwsApi.jar file yourself. You can download version `10.15` from here: https://interactivebrokers.github.io/# and within the downloaded archive file you'll find the required `TwsApi.jar`.
Unfortunately we are not allowed to redistribute the Interactive Brokers Java client, so you'll have to download the TwsApi.jar file yourself. You can download version `10.15` from here: https://interactivebrokers.github.io/# and within the downloaded archive file you'll find the required `TwsApi.jar`.

Then install the jar file in the local Maven repository on your machine using the following command:

Expand Down
2 changes: 1 addition & 1 deletion docs/THIRDPARTY.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ Roboquant couldn't have been developed without the use of free and open source t
* https://github.com/osiegmar/FastCSV[FastCSV]: an ultra-fast and easy to use CSV parser.

== Other artefacts
* Comfortaa font created by Johan Aakerlund. I really like how _roboquant_ looks like using Comfortaa font.
* `Comfortaa` font created by Johan Aakerlund. I really like how _roboquant_ looks like using `Comfortaa` font.
* Modified robot image from Free Vector Characters, as also seen on the README page and https://roboquant.org[roboquant.org] website.
8 changes: 4 additions & 4 deletions docs/TODO.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Version 0.8 is all about making sure that (back-)testing works, and the most com

Ensure the API is stable and start including AI and Machine Learning support

* [X] Stabalize the exposed API (perhaps also enable -Xexplicit-api=strict compiler flag)
* [X] Stabilize the exposed API (perhaps also enable -Xexplicit-api=strict compiler flag)
* [ ] Improve documentation, notebooks and examples based on the stable API
* [ ] Include additional demo feeds for quick expirementation (some forex and crypto assets)
* [ ] Include additional demo feeds for quick experimentation (some forex and crypto assets)
* [ ] Add basic Machine Learning support (research required)
* [ ] Add better hyper-parameter search and optimalization capabilities (research required)
* [ ] Add better hyperparameter search and optimization capabilities (research required)

== Version 1.0.x (end of 2022)

Expand All @@ -40,7 +40,7 @@ This version is all about adding better trading capabilities. Although there is
* [ ] Better margin account simulation support
* [ ] More metrics, especially around alpha and beta calculations
* [ ] Add more advanced slippage- and fee-models
* [ ] Add visualtizations for the tuning of strategies (research required)
* [ ] Add visualizations for the tuning of strategies (research required)
* [ ] Add support for distributed back-testing (research required)

== Version 2 and later (2023 and beyond)
Expand Down
2 changes: 1 addition & 1 deletion docs/run/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This directory contains various IntelliJ IDEA configuration files for testing roboquant.

== With Coverage
Run extended unit tests to improve code coverage. By default these extra unit tests are not enabled since they take too much extra time.
Run extended unit tests to improve code coverage. By default, these extra unit tests are not enabled since they take too much extra time.
The overall goal is to maintain a roboquant test coverage > 90%.

== Performance with Flight recorder
Expand Down
13 changes: 9 additions & 4 deletions roboquant-crypto/src/binance/BinanceBroker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import org.roboquant.common.Currency
import org.roboquant.common.Logging
import org.roboquant.feeds.Event
import org.roboquant.orders.*
import java.time.Instant

/**
* Implementation of the broker interface for Binance exchange. This enables live trading of cryptocurrencies
Expand All @@ -56,7 +57,7 @@ class BinanceBroker(


private val logger = Logging.getLogger(BinanceBroker::class)
private val placedOrders = mutableMapOf<Long, SingleOrder>()
private val placedOrders = mutableMapOf<Long, OrderState>()
private var orderId = 0
private val assetMap: Map<String, Asset>

Expand All @@ -81,7 +82,11 @@ class BinanceBroker(
for (order in client.getOpenOrders(OrderRequest(""))) {
val o = placedOrders[order.orderId]
if (o !== null) {
// o.fill = order.executedQty.toDouble()
val orderState = when (order.status) {
com.binance.api.client.domain.OrderStatus.FILLED -> o.copy(Instant.now(), OrderStatus.COMPLETED)
else -> o
}
_account.openOrders[order.orderId.toInt()] = orderState
} else {
logger.info("Received unknown order $order")
}
Expand Down Expand Up @@ -111,11 +116,11 @@ class BinanceBroker(

is LimitOrder -> {
val newLimitOrder = trade(symbol, order)
placedOrders[newLimitOrder.orderId] = order
placedOrders[newLimitOrder.orderId] = OrderState(order)
}
is MarketOrder -> {
val newMarketOrder = trade(symbol, order)
placedOrders[newMarketOrder.orderId] = order
placedOrders[newMarketOrder.orderId] = OrderState(order)
}
else -> logger.warning {
"supports only cancellation, market and limit orders, received ${order::class} instead"
Expand Down
2 changes: 1 addition & 1 deletion roboquant-crypto/src/xchange/XChangeBroker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.knowm.xchange.dto.trade.LimitOrder as CryptoLimitOrder
import org.knowm.xchange.dto.trade.MarketOrder as CryptoMarketOrder

/**
* Generic Crypto currency broker implementation for exchanges that are supported by the XChange package.
* Generic cryptocurrency broker implementation for exchanges that are supported by the XChange package.
*
* XChange is a Java library providing a streamlined API for interacting with 60+ Bitcoin and Altcoin exchanges
* See also https://knowm.org/open-source/xchange/ for a complete overview of the supported exchanges.
Expand Down
4 changes: 2 additions & 2 deletions roboquant-crypto/src/xchange/XChangeLiveFeed.kt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class XChangeLiveFeed(


/**
* Get an asset based on a crypto-currency pair.
* Get an asset based on a cryptocurrency pair.
*
* @return
*/
Expand All @@ -161,7 +161,7 @@ class XChangeLiveFeed(
}

/**
* Get an asset based on a crypto-currency pair.
* Get an asset based on a cryptocurrency pair.
*
* @param currencyPair
* @return
Expand Down
2 changes: 1 addition & 1 deletion roboquant-crypto/src/xchange/XChangePollingLiveFeed.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class XChangePollingLiveFeed(
override fun close() = jobs.cancelAll()

/**
* Get an asset based on a crypto-currency pair.
* Get an asset based on a cryptocurrency pair.
*
* @return
*/
Expand Down
2 changes: 1 addition & 1 deletion roboquant-extra/src/alpaca/AlpacaBroker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class AlpacaBroker(
}

/**
* Load the open orders already linked to the account. This is only called once during initiatlization.
* Load the open orders already linked to the account. This is only called once during initialization.
* Closed orders will be ignored.
*/
private fun loadInitialOrders() {
Expand Down
2 changes: 1 addition & 1 deletion roboquant-extra/src/alpaca/AlpacaConnection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ data class AlpacaConfig(
) {

init {
require(accountType == AccountType.PAPER) { "Only Paper tradins supported, received $accountType"}
require(accountType == AccountType.PAPER) { "Only Paper trading supported, received $accountType"}
}

}
Expand Down
2 changes: 1 addition & 1 deletion roboquant-extra/src/alpaca/AlpacaHistoricFeed.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class AlpacaHistoricFeed(
}

/**
* All available assets that can be retrieved. See [assets] for the assets that have already been retreived.
* All available assets that can be retrieved. See [assets] for the assets that have already been retrieved.
*/
val availableAssets by lazy {
AlpacaConnection.getAvailableAssets(alpacaAPI).values.toSortedSet()
Expand Down
1 change: 0 additions & 1 deletion roboquant-extra/src/alpaca/AlpacaLiveFeed.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class AlpacaLiveFeed(

/**
* Connect to ta market data provider and start listening. This can be the stocks or crypto market data feeds.
* 13 april 15:00 hendriks
*/
fun connect(
connection: MarketDataWebsocketInterface = alpacaAPI.stockMarketDataStreaming(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class AlphaVantageHistoricFeed(


/**
* Retrieve historic intra-day price data for the provided [assets]
* Retrieve historic intraday price data for the provided [assets]
*
*/
fun retrieveIntraday(vararg assets: Asset, interval: Interval = Interval.FIVE_MIN) {
Expand Down
6 changes: 3 additions & 3 deletions roboquant-extra/src/oanda/OANDA.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ object OANDA {

/**
* Create a [Roboquant] instance configured for back testing OANDA trading. Although trading Forex is just like any
* another asset class, there are some configuration paramters that are different from assets classes like stocks:
* another asset class, there are some configuration parameters that are different from assets classes like stocks:
* - Being short is as common as being long
* - The spread cost (for common currency pairs) is smaller than with most stocks
* - Leverage is high
* - There are no fees or commisions
* - There are no fees or commissions
*/
fun roboquant(strategy: Strategy, vararg metrics: Metric): Roboquant {
// We allow shorting
val policy = DefaultPolicy(shorting = true)

// No commisions or fees
// No commissions or fees
val feeModel = NoFeeModel()

// We use a lower spread model, since the default of 10 BIPS is too much for most Forex trading
Expand Down
8 changes: 4 additions & 4 deletions roboquant-extra/src/oanda/OANDABroker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import java.math.BigDecimal
import java.time.Instant

/**
* Implementation of the [Broker] interface that can be used for paper- en live-trading using OANDA as your broker.
* Implementation of the [Broker] interface that can be used for paper- and live-trading using OANDA as your broker.
*/
class OANDABroker(
private val maxLeverage: Double = 30.0, // Used to calculate buying power
Expand Down Expand Up @@ -103,7 +103,7 @@ class OANDABroker(

/**
* First time when connecting, update the state of roboquant account with broker account. Only cash and positions
* are synced and it is assumed there are no open orders pending.
* are synced, and it is assumed there are no open orders pending.
*/
private fun initAccount() {
val acc = ctx.account.get(accountID).account
Expand Down Expand Up @@ -172,7 +172,7 @@ class OANDABroker(
}

/**
* For now only market- and limit-orders are supported, all other order types are rejected. Also orders will
* For now only market- and limit-orders are supported, all others are rejected. Also orders will
* always TIF be submitted with FOK (FillOrKill) and ignore the requested TiF.
*/
override fun place(orders: List<Order>, event: Event): Account {
Expand Down Expand Up @@ -214,7 +214,7 @@ class OANDABroker(
_account.putOrder(state)
}

// OONDA doesn't update positions quick enough and so they don't reflect trades just made.
// OANDA doesn't update positions quick enough, and so they don't reflect trades just made.
// so for now we put a sleep in here :(
Thread.sleep(1000)
syncPortfolio()
Expand Down
4 changes: 2 additions & 2 deletions roboquant-extra/src/oanda/OANDALiveFeed.kt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class OANDALiveFeed(

/**
* Subscribe to the order book data for the provided [assets]. Since this is a pulling solution, you can also
* specify the [delay] interval between two pulls, default being 5000 milliseconds (so 5 seocond data)
* specify the [delay] interval between two pulls, default being 5000 milliseconds (so 5 second data)
*/
fun subscribeOrderBook(assets: Collection<Asset>, delay: Long = 5_000L) {
logger.info { "Subscribing to ${assets.size} order books" }
Expand Down Expand Up @@ -155,7 +155,7 @@ class OANDALiveFeed(
}
)
}
logger.fine("Got ${actions.size} orderbook actions")
logger.fine("Got ${actions.size} order-book actions")
if (actions.isNotEmpty()) channel?.offer(Event(actions, now))
since = resp.time
}
Expand Down
28 changes: 13 additions & 15 deletions roboquant-extra/test/samples/oanda.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import org.roboquant.policies.DefaultPolicy
import org.roboquant.strategies.EMACrossover
import java.util.logging.Level


fun oanda() {
val feed = OANDAHistoricFeed()
feed.retrieveCandles("EUR_USD", "USD_JPY", "GBP_USD")
Expand All @@ -46,7 +45,6 @@ fun oanda() {

}


fun forexAvro() {
val feed = AvroFeed("/Users/peter/data/avro/forex_march_2020.avro")
Config.exchangeRates = OANDAExchangeRates()
Expand All @@ -59,13 +57,24 @@ fun forexAvro() {
fun oandaLong() {
val feed = OANDAHistoricFeed()
val timeframe = Timeframe.parse("2020-03-01", "2020-04-01")
val symbols = listOf("EUR_USD", "USD_JPY", "GBP_USD", "AUD_USD", "USD_CAD", "USD_CHF", "EUR_GBP", "AUD_JPY", "NZD_USD", "GBP_JPY").toTypedArray()
val symbols = listOf(
"EUR_USD",
"USD_JPY",
"GBP_USD",
"AUD_USD",
"USD_CAD",
"USD_CHF",
"EUR_GBP",
"AUD_JPY",
"NZD_USD",
"GBP_JPY"
).toTypedArray()

// There is a limit on what we can download per API call, so we split it in individual days
for (tf in timeframe.split(1.days)) {
feed.retrieveCandles(*symbols, timeframe = tf)
println(feed.timeline.size)
Thread.sleep(1000) // lets play nice and not overload things
Thread.sleep(1000) // let's play nice and not overload things
}
feed.assets.summary().log()
println(feed.timeline.size)
Expand All @@ -76,7 +85,6 @@ fun oandaLong() {

}


fun oanda2() {
Currency.increaseDigits(3)
val feed = OANDAHistoricFeed()
Expand All @@ -88,7 +96,6 @@ fun oanda2() {
roboquant.broker.account.fullSummary().print()
}


fun oandaLive() {
val feed = OANDALiveFeed()
feed.subscribeOrderBook("EUR_USD", "USD_JPY", "GBP_USD")
Expand All @@ -97,7 +104,6 @@ fun oandaLive() {
println(actions.size)
}


fun oandaLive2() {
val feed = OANDALiveFeed()
feed.subscribePriceBar("EUR_USD", "USD_JPY", "GBP_USD", granularity = "S5", delay = 5_000L)
Expand All @@ -106,7 +112,6 @@ fun oandaLive2() {
println(actions.size)
}


fun oandaPaperTrading() {
Currency.increaseDigits(3) // We want to use extra digits when displaying amounts
val broker = OANDABroker()
Expand All @@ -125,7 +130,6 @@ fun oandaPaperTrading() {
roboquant.broker.account.fullSummary().print()
}


fun oandaClosePositions() {
val broker = OANDABroker()
Logging.setLevel(Level.FINE)
Expand All @@ -138,17 +142,13 @@ fun oandaClosePositions() {
broker.account.fullSummary().print()
}



fun oandaLiveRecord() {
val feed = OANDALiveFeed()
feed.subscribeOrderBook("EUR_USD", "USD_JPY", "GBP_USD")
val tf = Timeframe.next(5.minutes)
AvroUtil.record(feed, "/Users/peter/tmp/oanda.avro", tf)
}



fun oandaBroker() {
Config.exchangeRates = FixedExchangeRates(Currency.EUR, Currency.USD to 0.9, Currency.GBP to 1.2)
val broker = OANDABroker()
Expand All @@ -166,7 +166,6 @@ fun oandaBroker() {
broker.account.portfolio.summary().log()
}


fun oandaBroker3() {
Logging.setLevel(Level.FINE, "OANDABroker")
Currency.increaseDigits(3)
Expand Down Expand Up @@ -200,7 +199,6 @@ fun oandaBroker2(createOrder: Boolean = true) {
}
}


fun main() {
when ("OANDA_LIVE_FEED2") {
"OANDA_BROKER" -> oandaBroker()
Expand Down
Loading

0 comments on commit e62ad01

Please sign in to comment.