Code Monkey home page Code Monkey logo

timolson / cointrader Goto Github PK

View Code? Open in Web Editor NEW
445.0 70.0 164.0 4.98 MB

Coin Trader is a Java-based backend for algorithmically trading cryptocurrencies. It provides data collection and export, complex event processing and triggering, and backtesting - paper trading - live trading.

License: Other

Shell 0.04% ANTLR 0.12% Java 98.21% Batchfile 0.01% Python 1.63%
cryptocurrency trading-cryptocurrencies trading-platform trading-bot trading-algorithms

cointrader's People

Contributors

ayaohsu avatar cmshop avatar cvedetect avatar dependabot[bot] avatar douggie avatar jasperciti avatar jule64 avatar navonpartners avatar timolson avatar yzernik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cointrader's Issues

GeneralOrders Must Obey Fund Position Limits

Currently GeneralOrders are converted to SpecificOrders on the best-priced Market, but the Fund may not have a sufficient Position to execute the Trade. The GeneralOrder routing must break up the orders while obeying the limitation of the current Positions in the Fund. If there are insufficient Positions to execute the Trade, it should be reject()ed

Save Books as Diff

Books are large in the database. Save them as diffs against the prior Book, taking full Book snapshots every so often.

Support module specific esper.cfg.xml files

Over time people might want to have additional esper config per module to allow module level epl files to acess particular clasess and methods rather than having a single esper cfg file for the current sungle context that loads all the coresponding epl files.

This would require each module to have it's own esper sevrice provider which i believe is quite a big departure from today.

OrderUpdate events set the event time to actual time

When replaying data and using the mock order sercive orderupdate events are created with the actual time not the replay time of when the order was created,causing the lasttime of the context to be updated and throw exception in advance time in the context class when the next backdated replay event is processed.

Accounts Keystore

We need to save account names and passwords in an encrypted file, with a master password to enable access to the account file and live trading.

Write Service Docs

Document the idea of a Service
Document the OrderService and QuoteService

Reddcoin missing

Hi
Can you add this line of code?
/cointrader/src/main/java/org/cryptocoinpartners/schema/Currencies.java
public static final Currency RDD = crypto("RDD", 1e-8);

Basic Order Execution

Implement the Order interfaces designed by Mike
Provide market and limit order execution through XChange for specific MarketListings

Problem with decimal places

Hi

I've a problem with this method.
DiscreteAmount.roundedCountForBasis(price, market.getPriceBasis())

The variable price is 7.6E-7.
DiscreteAmount.roundedCountForBasis(price, market.getPriceBasis()) return 75. Thats not good.
I guess that I must market.getPriceBasis() change.

But where should/can I change this?

Exchange Cryptsy, DOGE/BTC

Support Streaming XChange Data

Some markets are finally offering push data which XChange supports. We need to enhance XchangeData to support the streaming API where available

Problems setting up cointrader

Hi,

I am trying to run cointrader following the wiki setup guide but it seems i cant run the console mode.

I get errors about a missing strategy (TurtelsStrategy):

21:12:34.057 [main] INFO  c.e.e.c.s.EPServiceProviderImpl - Initializing engine URI 'default' version 4.9.0
21:12:35.834 [main] DEBUG o.cryptocoinpartners.module.Context - no module file found for XchangeData.epl on classpath. Please ensure XchangeData.epl is in the resources directory.
21:12:35.848 [main] DEBUG o.cryptocoinpartners.module.Context - no module file found for BasicQuoteService.epl on classpath. Please ensure BasicQuoteService.epl is in the resources directory.
21:12:35.849 [main] DEBUG o.cryptocoinpartners.module.Context - subscribing private void org.cryptocoinpartners.module.BasicQuoteService.recordBook(org.cryptocoinpartners.schema.Book) with statement "select * from Book"
21:12:36.655 [main] DEBUG o.cryptocoinpartners.module.Context - subscribing private void org.cryptocoinpartners.module.BasicQuoteService.recordTrade(org.cryptocoinpartners.schema.Trade) with statement "select * from Trade"
21:12:36.675 [main] DEBUG o.cryptocoinpartners.module.Context - no module file found for XchangeAccountService.epl on classpath. Please ensure XchangeAccountService.epl is in the resources directory.
21:12:36.987 [main] INFO  c.e.e.c.s.StatementLifecycleSvcImpl - Failed to compile statement: Failed to resolve 'TurtelsStrategy.getMarket' to a property, single-row function, aggregation function, script, stream or class name com.espertech.esper.epl.expression.ExprValidationException: Failed to resolve 'TurtelsStrategy.getMarket' to a property, single-row function, aggregation function, script, stream or class name at com.espertech.esper.epl.expression.ExprNodeUtilResolveExceptionHandlerDefault.handle(ExprNodeUtilResolveExceptionHandlerDefault.java:31) ~[cointrader-0.3.0-SNAPSHOT-jar-with-dependencies.jar:na]

I have removed refereces to TurtelsStrategy in MockOrderService.epl and cointrader-esper.cfg.xml but still complaining that SubscribePortfolioEvent is not found:

23:30:47.109 [main] INFO  c.e.e.c.s.StatementLifecycleSvcImpl - Failed to compile statement: Failed to resolve event type: Event type or class named 'SubscribePortfolioEvent' was not found
com.espertech.esper.epl.expression.ExprValidationException: Failed to resolve event type: Event type or class named 'SubscribePortfolioEvent' was not found

I am using java 1.7.0 (Ubuntu).

Let me know if you need further information. Any help is much appreciated.

Thanks in advance,

Watches Broken After CSV Dump

  1. Run the console
  2. Use the 'csv' command to dump ticks to a file
  3. Now the 'watch' command doesn't show any results. Are other modules also broken?

Finish Implementing Amount

Both Amount and DecimalAmount still have some methods which throw Errors because they are unimplemented.

Windows Console Broken

Coin Trader uses the JLine library to work with the console, which requires a DLL to be installed in Windows. Users can download the DLL from the JLine site but we should try to bundle the DLL as a resource if we can.

Reconciliation

Report discrepencies between polled account information and internal accounting

Module Path

ModuleLoader currently assumes org/cryptocoinpartners/module as the classpath for finding the module name. This needs refactored to iterate through a module.path configuration setting.

Create Amount

Convert DiscreteAmount into just Amount. It should be immutable and preserve the orginal input type whether long/long or double or BigDecimal, but freely cast to the other forms. Record of remainder shall be accumulated until settlement() is called using a RemainderHandler.

Support cointrader-esper.cfg.xml

Currently the context loads the default service provider config. Might want to load a cointrader specific cfg file to alter engine settings, incorprate libraries into epl statements etc.

Coinbase Book Exception

When Coinbase is enabled in cointrader.properties, you get an exception from the XChange adapter about the service being unimplemented. Coinbase doesn't supply an order book since they are a market maker.

One way to resolve this is to mock an order book with one bid and one ask, at Coinbase's stated price, with the useraccount's trade limit as the volume. We should be able to get that information from the XChange class CoinbaseAccountServiceRaw

We should also have better configuration in the xchange properties to configure xchange queries. Look at the inner class XchangeData.FetchTradesRunnable.run() method, which gets called whenever a query is available from the RateLimiter.

Implement stop loss orders

Hi tim, hope all is well.

Wondered what your thoughts were on a stop loss order via the following implementation.

Strategy creates a general order of type stop loss with or without a market. This is then executed as a limit order as per the existing base order service,then any fills for an order that has a parent of filltype stop _loss,the base order service creates another general order of type stop limit that is triggered and converted to a specific order abd executed on the exchange nce the stop price is triggered.

Means a bit of a change to general order defination to be an order that is internal to coin trader and a specific order being an order placed to an external party, in which case a general order could have a market as it might be a order that the strategy has determined the market but wants to gain order types not avaiable on the market such as stop, iceberg, gtd, vwap etc but leverage cointraders synethic order types.

Let me know your thoughts.

Spin wait timeout when running save-data on aws micro instance

When running save-data on free tier aws, esper engine shutdown to to one of the threads not retuning within 100ms, resulting in a spin wait time out.

Back test and console modes work fine,so i suspect the save data run mode is making a http request that fails or does not return when running on aws, possible due to https authentication. The watch mode works fine from the console so the get ticker requests seem to work.

Basic Accounting

Implement Account
Connect through XChange to poll account information

Console shows inactive exchanges

After adding Coinbase & CampBXExchange as new entries to cointrader.properties, I commented them out (and had previously removed them from -default.properties. After entering "exchanges" into the console, they continue to show up as valid exchanges. (See screenshots attached)
console image
properties image

Expected Behavior: Only those active exchanges should appear as options in console.

Convert to Guice

Coin Trader is a great fit for dependency injection. I hacked Module Loader but Guice is probably the way to go

Default configuration retrieval fails with MapConfiguration object

Config has been updated to be a MapConfiguration from a CombinedConfiguration object. If no value is present in the map, it fails with a null pointer, rather then returning null as per the CombinedConfiguration object.

Possible work around is to try/catch and handle the null pointer and then set the default value in the MapConfiguration.

console mode throws "module fake not found" exception

I am getting the following error when running the program with the "console" argument:

"
java.lang.Error: Could not find module named fake in module.path
at org.cryptocoinpartners.module.Context.attach(Context.java:132) ~[classes/:na]
at org.cryptocoinpartners.schema.StrategyInstance.afterAttach(StrategyInstance.java:64) ~[classes/:na]
at org.cryptocoinpartners.module.Context.attach(Context.java:158) ~[classes/:na]
at org.cryptocoinpartners.bin.ConsoleRunMode.init(ConsoleRunMode.java:115) ~[classes/:na]
at org.cryptocoinpartners.bin.ConsoleRunMode.run(ConsoleRunMode.java:40) ~[classes/:na]
at org.cryptocoinpartners.bin.Main.main(Main.java:100) ~[classes/:na]
"

I can see "fake" being set at line 114 in ConsoleRunModule.java though not sure what it's supposed to do.
Appreciate any help

UI Mockups

I'm working on some rough mockups for a proposed UI in Balsamiq right now. I'll export them as PDF and submit a pull request when completed. Creating this issue to let other contributors know this is in progress. (Btw, I don't seem to have the ability to tag issues as "enhancement", "bug", etc.)

Add Currencies

The Currencies class has a bunch of Currency singletons which define the symbol and basis. There are many Currencys commented out because I haven't done the basis research yet, so if you know the smallest unit the coin trades in, please add the information in Currencies, following the examples

    public static final Currency USD = fiat("USD",0.01);
    public static final Currency CNY = fiat("CNY",0.01);

    public static final Currency BTC = crypto("BTC",1e-8);
    public static final Currency LTC = crypto("LTC",1e-8);

Order Routing

Allow Orders to be placed against a Listing instead of MarketListing. Such orders may be routed to the best-priced Market which has a Position with sufficient buying power.

Move to Java 8 – Comments?

Java 8 has some great features which would work well with Coin Trader. For example, closures could be attached to Esper statements in a one-off fashion.
Does anyone have comments about migrating the project to Java 8?

Polling Groups

Currently, all market polling obeys limits per-Exchange, but we should allow different groupings. For example, a user might want to focus high-frequency on BTC.USD but only poll altcoins during spare queries.
Implementationwise, the TokenBucket could be instantiated 1-for-1 with the query groups, but we need to enforce Exchange-wide limits... must think on this

Strategy State Machine

Create a simple Strategy base class which implements a state machine. The states should reflect whether the Strategy is currently in a trade or not.

Enable c3p0

Hibernate complains about the lack of a real connection manager. Let's add the c3p0 connection pool and configure it in persistence.xml

11:06:35.949 [main] WARN o.h.e.j.c.i.DriverManagerConnectionProviderImpl - HHH000402: Using Hibernate built-in connection pool (not for production use!)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.