GithubHelp home page GithubHelp logo

abides-jpmc-public's People

Contributors

andrea94c avatar aymericcamoulin avatar dependabot[bot] avatar jaredvann avatar jpmsrh avatar selimamrouni 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

Watchers

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

abides-jpmc-public's Issues

NoiseAgent order event times bug in ABIDES-market demo

Hi,
I am currently working on a RL project and want to use ABIDES (Gym) to create a gym market making environment.
I followed the installation instructions and ran the demo_ABIDES-market.ipynb file to test if everthing works correctly.

There is an issue with the NoiseAgent order submission times in the demo, the event time for all submitted orders is logged at 0. Taking a look at the parsed logs dataframe for NoiseAgent and their submitted order with logs_df[ (logs_df.agent_type == "NoiseAgent") & (logs_df.EventType=="ORDER_SUBMITTED") ] one can see that the event time for every entry is 0.

Bildschirmfoto 2023-06-28 um 19 50 09

Their are no issues for any other agent types in the demo file, their event times for submitted orders are in between market open and close. I looked at the files abides-markets/agent/noiseagent.py as well as at the function parse_logs_df in abides-markets/utils.py but could not find a solution.

I am worried that this issue causes problem when setting up a new ABIDES-gym environment and running the rmsc04market i the background.

Do you have any idea why this problem occurs with NoiseAgents?

Thank you and best, Felix

SparseMeanRevertingOracle's Ornstein-Uhlenbeck step has inncorect scale/standard deviation

From compute_fundamental_at_timestamp

        mu = s["r_bar"]
        gamma = s["kappa"]
        theta = s["fund_vol"]

        # The OU process is able to skip any amount of time and sample the next desired value
        # from the appropriate distribution of possible values.
        v = s["random_state"].normal(
            loc=mu + (pv - mu) * (exp(-gamma * d)),
            scale=((theta) / (2 * gamma)) * (1 - exp(-2 * gamma * d)),
        )

np.RandomState.normal's scale argument should be the standard deviation of the OU process, but the variance is passed instead.

The variance for this time step can be verified here https://planetmath.org/ornsteinuhlenbeckprocess
or here
https://en.wikipedia.org/wiki/Ornstein%E2%80%93Uhlenbeck_process
with cov(x_t, x_t)

Adjusting to scale=np.sqrt(((theta) / (2 * gamma)) * (1 - exp(-2 * gamma * d)))
will at least make the mean reversion consistent with the variance of this step, but I also propose making a symbol change from theta to theta**2 as well for consistency.

The theta parameter is labelled as the "fundamental volatility" of the Brownian motion component of the SDE, but it is being used as the variance of the component following this pull request in the original repository: abides-sim/abides#18

Problem with checkpoints when running .restore(checkpoints) method

Hi, I am encountering the following error:

TypeError: can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.

This code comes from the following line in the policyRL() class:
self.trainer.restore(best_checkpoint)

I believe there is a problem on the checkpoints fetched by the function:
best_checkpoint = analysis.get_best_checkpoint(trial = best_trial_path, mode='max')

Does anyone know how to solve this?

Installation errors and warnings

Hi,

after updating my MacBook, I have noticed a few installation errors and warnings. I have fixed them as follows, but I have thought that you may wanted to take a look at them too.

gym

The pin to version 0.18.0 is problematic, since it gives:

ERROR: Failed building wheel for Pillow
Running setup.py clean for Pillow
Failed to build Pillow
ERROR: Could not build wheels for Pillow, which is required to install pyproject.toml-based projects

Installing the latest version removes this issue. However, note that gym is no longer maintained (see the dev notice at https://github.com/openai/gym).

setup.py / easy_install

The installation steps in the readme file are no longer working on my MacBook. I get a series of warnings along the lines of

********************************************************************************
Please avoid running ``setup.py`` and ``easy_install``.
Instead, use pypa/build, pypa/installer, pypa/build or
other standards-based tools.

See https://github.com/pypa/setuptools/issues/917 for details.
********************************************************************************

and a few permission issues at the end. Running it with sudo -H (after updating requirements.txt as described above) seems to work fine. However, using sudo -H may not be advisable for pip.

rmsc03 does not seem to work

I have installed ABIDES following the description in the readme file. While rmsc04 works fine, I am having troubles with rmsc03. As soon as I try to import it, I get the following error message:

>>> from abides_markets.configs import rmsc03
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.9/site-packages/abides_markets-0.0.0-py3.9.egg/abides_markets/configs/rmsc03.py", line 11, in <module>
ImportError: cannot import name 'POVExecutionAgent' from 'abides_markets.agents' (/usr/local/lib/python3.9/site-packages/abides_markets-0.0.0-py3.9.egg/abides_markets/agents/__init__.py)

Have you ever encountered this error before?

Incorrect sigma_t update in ValueAgent

In ValueAgent.updateEstimates():

self.sigma_t = (self.sigma_n * self.sigma_t) / (self.sigma_n + self.sigma_t)

This line provides incorrect sigma_t estimate, should be:

self.sigma_t = (self.sigma_n * sigma_tprime) / (self.sigma_n + sigma_tprime)

or, equivalentely:

self.sigma_t  = sigma_tprime
self.sigma_t = (self.sigma_n * self.sigma_t) / (self.sigma_n + self.sigma_t) 

This leads to incorrect r_t, sigma_t and r_T estimates (since start value for sigma_t is always 0, sigma_t is always 0).

EventTime Issue

Hi! When running demo_ABIDES-Markets.ipynb I get an empty histogram as the one shown below.

Screenshot 2023-09-19 at 11 58 58 AM

After reviewing the code, I identified that abides_core.parse_logs_df sets the EventTime of message to zero if the first element of the message is not of type int or np.int64 (see line 133). It seems that whenever a NoiseAgent sends an order, the time of such order is interpreted as a float and not an int. I tried finding the line of code that was causing this behavior in the NoiseAgent class unsuccessfully. However I changed the line 199 in the file abides_core/agent.py from self.current_time = current_time to self.current_time = int(current_time) and the issue seems to have been corrected but I am unsure wether this modification might be messing up other processes.

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.