Code Monkey home page Code Monkey logo

fincal's People

Contributors

bomper avatar hhamilto avatar kevinoid avatar larsbuur avatar olegam avatar zgsrc 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

Watchers

 avatar  avatar  avatar

fincal's Issues

Clarify license. ISC or MIT?

package.json lists the license as ISC and README.md contains the text of the ISC license in the License section, but the LICENSE file contains the text of the MIT License. Could you please clarify which of these licenses applies to the project. Thanks!

Various issues regarding timezones

Hey there, thanks for your work in setting up this project. I've been eager to use it in some of my projects.

I had a few questions surrounding the usage of the tradingSession functions. I've been using the new_york calendar exclusively for these examples.

The tradingSession and tradingSessions calls seem to return incorrect results when called with a specific moment.

console.log(calendar.tradingSessions(moment("2020-09-01T16:30:00.000Z")));
console.log(calendar.tradingSessions(moment("Tue, 01 Sep 2020 9:30:00 PDT")));

both yield moments where the start is 2020-09-01T16:30:00.000Z and the end is 2020-09-01T23:00:00.000Z, even though the expected UTC times for NYC are 13:30 to 20:00.

Debugging a bit into this, it seems like this is because the sessions are created assuming 9:30am and 4:00pm in the local timezone, which in my case is America/Los_Angeles. Is there a way to retrieve the correct NYC-based moments for the trading sessions? Or to derive the correct start/end times for GMT-7?

I noticed the setTimezoneHere method in the documentation, which didn't work correctly out of the package as it isn't attached to the fincal or calendar objects. I pulled the method into the calendar export and tried calling calendar.setTimezoneHere("America/Los_Angeles"); before the same lines above with no change.

For the nextTradingSession function, I noticed that it only supports days and not specific times. Is there any plans to support this or any alternatives? Assuming I can get the first problem figured out I'm also happy to tinker with it.

Add support for E-mini contracts on GLOBEX

It's MLK evening over in the US right now (10:30pm Eastern) and GLOBEX is in session, but fincal.calendar('new_york').areMarketsOpenNow(true) returns false because the code concludes today is a holiday.

image

OK, GLOBEX is not "new_york", so this might be a feature request to add "chicago", but the logic at line 421 is still wrong for E-mini contracts that trade for 23.25 hours a day.

Tokyo and Sydney have Shanghai timezone?

$ grep exports.timezone locales/*.js
locales/copenhagen.js:exports.timezone = "Europe/Copenhagen";
locales/frankfurt.js:exports.timezone = "Europe/Berlin";
locales/hong_kong.js:exports.timezone = "Asia/Hong_Kong";
locales/london.js:exports.timezone = "Europe/London";
locales/new_york.js:exports.timezone = "America/New_York";
locales/paris.js:exports.timezone = "Europe/Paris";
locales/shanghai.js:exports.timezone = "Asia/Shanghai";
locales/sydney.js:exports.timezone = "Asia/Shanghai";
locales/tokyo.js:exports.timezone = "Asia/Shanghai";

So, the last two seem wrong. Sydney is 3 hours ahead of Shanghai (this time of year)!

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.