Files
quantconnect--lean/Common/TimeZones.cs
T
Balamurali Pandranki c22a538bad Indian stock markets support & Zerodha brokerage implementation (#4873)
* Indian stock markets & Samco and Zerodha brokerage implementations

* Build fixes & Implement multi leg orders (BracketOrder & CoverOrder)

* Build fixes

* Clean & refactor

* Clean up & remove samco brokerage

* Clean up & remove samco brokerage

* Fix Nifty, BankNifty & Sensex Index futures expiry time functions

* Fix Nifty, BankNifty & Sensex Index futures expiry time functions

* Fix Futures Expiry Testcases

* Fix Futures Expiry Testcases

* Refactor Zerodha Symbol Mapper

* Refactor Zerodha Symbol Mapper

* Add Future symbols to symbol prop db csv

* Fix Symbol Mapper context

* Fix Market Hours Database

* Fix OrderJsonConverter

* Add Zerodha AccountBaseCurrency

* Add QuantConnect License headers to new source files

* cleanup config.json formatting & tick aggregator implementation

* cleanup config.json formatting & tick aggregator implementation

* Refactor ZerodhaBrokerageModel

* Fix

* Build Fixes

* Refactor

* Refactor Brokerage class & remove TextFieldParser

* Refactor Brokerage FeeModel

* Add ZerodhaOrderProperties

* Add Refactor HistoryProvider

* Refactor CanExecuteOrder

* Refactor SymbolMapper

* Refactor market names

* Refactor & remove Zerodha subscription manager

* Refactor & remove ZerodhaWebSocketChannels

* Refactor & remove ZerodhaWebSocketChannels

* Refactor ZerodhaBrokerage

* Refactor symbol prop db

* zerodha update downloader ticker data using symbol name

* 1 Zerodha mapper class update to get instruments based on Market. 2 Zerodha Getholdings data fetch fix.

* Update market-hours-database.json

* Implement basic testcases for ZerodhaBrokerage

* Update market-hours-database.json

* Update Market.cs

* 1 Fix for Zerodha subscriber and unsubscribe 2 User of CSVHelper to read instrument list

* Rename Zerodha DataQueueHandler class implementation

* Changes related to TradeBar and emit tick

* Fix DataQueueUniverseProvider & Handle Timezone conversion in WS EmitQuotes

* Emit Order Fixes

* DataQueueHandler refactoring and build fix

* Update config.json

* Removal of IHistoryProvider impplementation

* Reverting timezone logic as already taken care by BrokerImplementation using Unix time

* Place, modify and cancel order implementation

* fix zerodha test cases

* Updating get quotes and restricting getHoldings to MIS

* Testcase Fixes

* Testcase Fixes

* Testcase Fixes

* Updating emitFillOrder

* Add ProductType to ZerodhaOrderProperties

* Addition of ZerodhaProduct Type property and test update

* Fix for unit tests and minor changes for place and update order

* Unit test fix for Zerodha

* Addition of the product type and trading segment configs

* PR review fixes

* Addition of trading segment and product type configs

* Nuget Fixes

* Fix ZerodhaBrokerage DataQueueHandler

* Cleanup OrderTypes & rm global.json

* Update UpdateOrderRequest.cs

* Removal of custom csvreader

* Implementing additional method CanPerformSelection

* Add LiveOptionChainProvider

* Clean up and add QC license headers

* Quick cleanup

* Update ZerodhaBrokerage.cs

* Fix OrderEvent timezone conversions

* use item.Unrealised for Intraday position holdings

* Refactor Option chain get instruments calls

* Refactor Option chain get instruments calls

* Review fixes

* Remove whitespaces

* Updating options strike price

* Undo time stamp change

* Optional gethistory

* Addition of comments and minor changes

* Build Fixes

* Add comments for LogType enums

* Options fix

* Fix json name in CsvInstrument

* Update tick generation in DataQueueHandler

- Use Timestamp field for both trades and quotes
- Fix incorrect bid/ask sizes
- Avoid reading depth on each tick to find top quote
- Use new Tick constructors
- Remove unnecessary locking

* Add missing null check in Utils.StringToDate

* Order fixes

- Include TriggerPending orders in GetOpenOrders
- Remove unnecessary invalid check in PlaceOrder
- Fix GetOrderPrice and GetOrderTriggerPrice

* Zerodha account balance fetch

* Removal of Futures and Options

* Remove Futures & Options Support

* Update ZerodhaBrokerage.cs

* Update ZerodhaBrokerage.cs

* Add License headers

* Add License Headers

* Refactor

* historical TradeBar & security fee calculation fixes

* fix brokerage test case

* Update ZerodhaBrokerage.cs

* Update ZerodhaBrokerageHistoryProviderTests.cs

Co-authored-by: Aman Ray <ray.aman9876@gmail.com>
Co-authored-by: Stefano Raggi <stefano.raggi67@gmail.com>
2021-03-08 18:51:54 -03:00

226 lines
9.7 KiB
C#

/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* 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 http://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.
*/
using NodaTime;
namespace QuantConnect
{
/// <summary>
/// Provides access to common time zones
/// </summary>
public static class TimeZones
{
/// <summary>
/// Gets the Universal Coordinated time zone.
/// </summary>
public static readonly DateTimeZone Utc = DateTimeZone.Utc;
/// <summary>
/// Gets the time zone for New York City, USA. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone NewYork = DateTimeZoneProviders.Tzdb["America/New_York"];
/// <summary>
/// Get the Eastern Standard Time (EST) WITHOUT daylight savings, this is a constant -5 hour offset
/// </summary>
public static readonly DateTimeZone EasternStandard = DateTimeZoneProviders.Tzdb["UTC-05"];
/// <summary>
/// Gets the time zone for London, England. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone London = DateTimeZoneProviders.Tzdb["Europe/London"];
/// <summary>
/// Gets the time zone for Hong Kong, China.
/// </summary>
public static readonly DateTimeZone HongKong = DateTimeZoneProviders.Tzdb["Asia/Hong_Kong"];
/// <summary>
/// Gets the time zone for Tokyo, Japan.
/// </summary>
public static readonly DateTimeZone Tokyo = DateTimeZoneProviders.Tzdb["Asia/Tokyo"];
/// <summary>
/// Gets the time zone for Rome, Italy. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Rome = DateTimeZoneProviders.Tzdb["Europe/Rome"];
/// <summary>
/// Gets the time zone for Sydney, Australia. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Sydney = DateTimeZoneProviders.Tzdb["Australia/Sydney"];
/// <summary>
/// Gets the time zone for Vancouver, Canada.
/// </summary>
public static readonly DateTimeZone Vancouver = DateTimeZoneProviders.Tzdb["America/Vancouver"];
/// <summary>
/// Gets the time zone for Toronto, Canada. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Toronto = DateTimeZoneProviders.Tzdb["America/Toronto"];
/// <summary>
/// Gets the time zone for Chicago, USA. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Chicago = DateTimeZoneProviders.Tzdb["America/Chicago"];
/// <summary>
/// Gets the time zone for Los Angeles, USA. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone LosAngeles = DateTimeZoneProviders.Tzdb["America/Los_Angeles"];
/// <summary>
/// Gets the time zone for Phoenix, USA. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Phoenix = DateTimeZoneProviders.Tzdb["America/Phoenix"];
/// <summary>
/// Gets the time zone for Auckland, New Zealand. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Auckland = DateTimeZoneProviders.Tzdb["Pacific/Auckland"];
/// <summary>
/// Gets the time zone for Moscow, Russia.
/// </summary>
public static readonly DateTimeZone Moscow = DateTimeZoneProviders.Tzdb["Europe/Moscow"];
/// <summary>
/// Gets the time zone for Madrid, Span. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Madrid = DateTimeZoneProviders.Tzdb["Europe/Madrid"];
/// <summary>
/// Gets the time zone for Buenos Aires, Argentia.
/// </summary>
public static readonly DateTimeZone BuenosAires = DateTimeZoneProviders.Tzdb["America/Argentina/Buenos_Aires"];
/// <summary>
/// Gets the time zone for Brisbane, Australia.
/// </summary>
public static readonly DateTimeZone Brisbane = DateTimeZoneProviders.Tzdb["Australia/Brisbane"];
/// <summary>
/// Gets the time zone for Sao Paulo, Brazil. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone SaoPaulo = DateTimeZoneProviders.Tzdb["America/Sao_Paulo"];
/// <summary>
/// Gets the time zone for Cairo, Egypt.
/// </summary>
public static readonly DateTimeZone Cairo = DateTimeZoneProviders.Tzdb["Africa/Cairo"];
/// <summary>
/// Gets the time zone for Johannesburg, South Africa.
/// </summary>
public static readonly DateTimeZone Johannesburg = DateTimeZoneProviders.Tzdb["Africa/Johannesburg"];
/// <summary>
/// Gets the time zone for Anchorage, USA. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Anchorage = DateTimeZoneProviders.Tzdb["America/Anchorage"];
/// <summary>
/// Gets the time zone for Denver, USA. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Denver = DateTimeZoneProviders.Tzdb["America/Denver"];
/// <summary>
/// Gets the time zone for Detroit, USA. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Detroit = DateTimeZoneProviders.Tzdb["America/Detroit"];
/// <summary>
/// Gets the time zone for Mexico City, Mexico. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone MexicoCity = DateTimeZoneProviders.Tzdb["America/Mexico_City"];
/// <summary>
/// Gets the time zone for Jerusalem, Israel. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Jerusalem = DateTimeZoneProviders.Tzdb["Asia/Jerusalem"];
/// <summary>
/// Gets the time zone for Shanghai, China.
/// </summary>
public static readonly DateTimeZone Shanghai = DateTimeZoneProviders.Tzdb["Asia/Shanghai"];
/// <summary>
/// Gets the time zone for Melbourne, Australia. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Melbourne = DateTimeZoneProviders.Tzdb["Australia/Melbourne"];
/// <summary>
/// Gets the time zone for Amsterdam, Netherlands. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Amsterdam = DateTimeZoneProviders.Tzdb["Europe/Amsterdam"];
/// <summary>
/// Gets the time zone for Athens, Greece. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Athens = DateTimeZoneProviders.Tzdb["Europe/Athens"];
/// <summary>
/// Gets the time zone for Berlin, Germany. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Berlin = DateTimeZoneProviders.Tzdb["Europe/Berlin"];
/// <summary>
/// Gets the time zone for Bucharest, Romania. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Bucharest = DateTimeZoneProviders.Tzdb["Europe/Bucharest"];
/// <summary>
/// Gets the time zone for Dublin, Ireland. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Dublin = DateTimeZoneProviders.Tzdb["Europe/Dublin"];
/// <summary>
/// Gets the time zone for Helsinki, Finland. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Helsinki = DateTimeZoneProviders.Tzdb["Europe/Helsinki"];
/// <summary>
/// Gets the time zone for Istanbul, Turkey. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Istanbul = DateTimeZoneProviders.Tzdb["Europe/Istanbul"];
/// <summary>
/// Gets the time zone for Minsk, Belarus.
/// </summary>
public static readonly DateTimeZone Minsk = DateTimeZoneProviders.Tzdb["Europe/Minsk"];
/// <summary>
/// Gets the time zone for Paris, France. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Paris = DateTimeZoneProviders.Tzdb["Europe/Paris"];
/// <summary>
/// Gets the time zone for Zurich, Switzerland. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Zurich = DateTimeZoneProviders.Tzdb["Europe/Zurich"];
/// <summary>
/// Gets the time zone for Honolulu, USA. This is a daylight savings time zone.
/// </summary>
public static readonly DateTimeZone Honolulu = DateTimeZoneProviders.Tzdb["Pacific/Honolulu"];
/// <summary>
/// Gets the time zone for Kolkata, India.
/// </summary>
public static readonly DateTimeZone Kolkata = DateTimeZoneProviders.Tzdb["Asia/Kolkata"];
}
}