diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index bfcc97c..becfef5 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -59,6 +59,7 @@ jobs: source:jar \ -s settings.xml \ -Dgpg.passphrase=${{ secrets.MAVEN_GPG_PASSPHRASE }} \ + -DreleaseVersion=${{ github.event.inputs.releaseVersion }} \ -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }} \ deploy env: diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml new file mode 100644 index 0000000..02b915b --- /dev/null +++ b/.idea/git_toolbox_prj.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..ced6724 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index ecfa09c..b173c63 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..067a3ea --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,66 @@ +# Contributing Guidelines + +Thank you for considering contributing to the IEX Cloud API Wrapper Library for Java! We welcome your contributions to make this library even better. Please take a moment to read these guidelines to understand how you can contribute. + +## Reporting Issues + +If you encounter a bug, have a feature request, or any other issue related to this library, please check the following steps before creating an issue: + +1. Search the [GitHub issues](https://github.com/F4pl0/iex-cloud-java/issues) to see if the issue has already been reported. + +2. Ensure your issue is relevant to this project and not a general IEX Cloud API issue. + +3. If you find an existing issue, feel free to comment on it to provide more information or express your interest in it. + +4. If you can't find an existing issue, please create a new one and include the following details: + - A descriptive title. + - A clear and detailed description of the issue. + - Steps to reproduce the problem (if applicable). + - Any error messages or stack traces. + - Information about your environment (Java version, operating system, etc.). + +## Pull Requests + +We welcome pull requests that improve the library, fix bugs, or add new features. To submit a pull request, please follow these steps: + +1. Fork the repository. + +2. Create a new branch with a meaningful name for your changes. + +3. Make your changes, ensuring that your code follows the project's coding standards and conventions. + +4. Write unit tests if applicable. + +5. Update the project's documentation if necessary. + +6. Ensure that your code doesn't introduce any new warnings or errors. + +7. Commit your changes and write a clear and concise commit message that describes what you did. + +8. Push your changes to your fork on GitHub. + +9. Create a pull request from your branch to the main repository's `main` branch. + +10. In your pull request description, provide a clear and detailed explanation of your changes. Mention if your PR is fixing a specific issue, and reference that issue. + +11. Be responsive to any comments or feedback from maintainers or contributors. + +## Code Style + +- Follow the existing code style in the project. If in doubt, refer to the existing code and use consistent formatting. + +- Use meaningful variable and method names. + +- Write comments for complex or non-obvious parts of your code. + +## Testing + +- Ensure that your changes do not break existing tests. + +- If you introduce new features or fix bugs, include tests to cover the new code. + +## Licensing + +By contributing to this project, you agree that your contributions will be licensed under the project's [MIT License](LICENSE). If you include any third-party code or libraries, please make sure they are compatible with the project's license. + +Thank you for your contribution to the IEX Cloud API Wrapper Library for Java! Your efforts help improve the library for everyone. \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c83f490 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2023 f4pl0 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c20e02c --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +# iex-cloud-java + +![IEX Cloud Logo](https://www.giantmachines.com/wp-content/uploads/2023/03/5e7e3da8df522d95bd159c94_IEX-Cloud-e1680079186819.png) + +This is a Java library for interfacing with the [IEX Cloud](https://iexcloud.io/) API. It provides a convenient and straightforward way to access a wide range of financial market data, such as stock quotes, historical data, and more. + +## Table of Contents + +- [Installation](#installation) +- [Usage](#usage) +- [Examples](#examples) +- [Documentation](#documentation) +- [Contributing](#contributing) +- [License](#license) + +## Installation + +You can add this library to your Java project using Maven: + +```xml + + io.github.f4pl0 + iex-cloud + 1.12.0 + +``` + +Or, if you are using Gradle: + +```gradle +dependencies { + implementation 'io.github.f4pl0:iex-cloud:1.12.0' +} +``` + +## Usage + +Before using this library, you will need to obtain an API key from IEX Cloud. You can sign up for an API key [here](https://iexcloud.io/cloud-login#/register/). + +Once you have an API key, you can use it to initialize the IEX Cloud client: + +```java +import io.github.f4pl0.IEXCloudClient; + +public class Main { + public static void main(String[] args) { + IEXCloudClient client = new IEXCloudClient.IEXCloudClientBuilder() + .setPublishableToken("pk_yourpublishabletoken") + .build(); + } +} +``` + +You can then use the client to access various endpoints of the IEX Cloud API. + +## Examples + +Here are some examples of how to use this library: + +### Get a Stock Quote + +```java +StockQuote quote = client.getStockQuote("AAPL"); +System.out.println("Apple Inc. (AAPL) current price: " + quote.getLatestPrice()); +``` + +### Retrieve Historical Prices + +```java +List historicalPrices = client.getHistoricalPrices("AAPL", 5, ChartRange.ONE_MONTH); +for (HistoricalPrice price : historicalPrices) { + System.out.println(price.getDate() + ": " + price.getClose()); +} +``` + +### Fetch Market News + +```java +List news = client.getMarketNews(); +for (NewsArticle article : news) { + System.out.println(article.getHeadline()); +} +``` + +## Documentation + +For more details on how to use this library and the available API endpoints, refer to the [wiki](https://github.com/F4pl0/iex-cloud-java/wiki). + +## Contributing + +Contributions from the community are welcome. If you find a bug, have a feature request, or want to contribute in any way, please check out our [contribution guidelines](CONTRIBUTING.md). + +## License + +This library is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. + +--- + +Enjoy using the IEX Cloud API Wrapper Library for Java! If you have any questions or need assistance, please feel free to [open an issue](https://github.com/F4pl0/iex-cloud-java/issues). \ No newline at end of file diff --git a/pom.xml b/pom.xml index d868e34..6a4d6a4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ io.github.f4pl0 iex-cloud - 1.11.3-SNAPSHOT + 1.12.0 jar IEX Cloud Java wrapper for IEX Cloud API @@ -126,7 +126,6 @@ ossrh https://s01.oss.sonatype.org ${env.AUTO_RELEASE_AFTER_CLOSE} - 600 diff --git a/src/main/java/io/github/f4pl0/IEXCloudClient.java b/src/main/java/io/github/f4pl0/IEXCloudClient.java index 5f312f8..53ec146 100644 --- a/src/main/java/io/github/f4pl0/IEXCloudClient.java +++ b/src/main/java/io/github/f4pl0/IEXCloudClient.java @@ -1,21 +1,31 @@ package io.github.f4pl0; +import io.github.f4pl0.config.ConfigInjector; +import io.github.f4pl0.config.IEXCloudConfig; import io.github.f4pl0.equitiesmarketdata.EquitiesMarketData; import io.github.f4pl0.reference.Reference; +/** + * The IEXCloudClient is the main entry point for the IEX Cloud API. + * You will need to set the publishable token before building the client. + */ public class IEXCloudClient { public final EquitiesMarketData equitiesMarketData; public final Reference reference; + /** + * Create a new IEXCloudClient. + * @param config + */ private IEXCloudClient(IEXCloudConfig config) { - - equitiesMarketData = new EquitiesMarketData(config); - reference = new Reference(config); + ConfigInjector.injectIEXConfiguration(IEXHttpClient.getInstance(), config); + equitiesMarketData = new EquitiesMarketData(); + reference = new Reference(); } /** * Builder for the IEXCloudClient. - * You will need to set the publishable and secret tokens before building the client. + * You will need to set the publishable token before building the client. */ public static class IEXCloudClientBuilder { private String publishableToken; diff --git a/src/main/java/io/github/f4pl0/IEXCloudConfig.java b/src/main/java/io/github/f4pl0/IEXCloudConfig.java deleted file mode 100644 index 78f0a7b..0000000 --- a/src/main/java/io/github/f4pl0/IEXCloudConfig.java +++ /dev/null @@ -1,10 +0,0 @@ -package io.github.f4pl0; - -import lombok.Data; - -@Data -public class IEXCloudConfig { - private String publishableToken; - private String secretToken; - private String baseEndpoint; -} \ No newline at end of file diff --git a/src/main/java/io/github/f4pl0/IEXHttpClient.java b/src/main/java/io/github/f4pl0/IEXHttpClient.java new file mode 100644 index 0000000..3bbcade --- /dev/null +++ b/src/main/java/io/github/f4pl0/IEXHttpClient.java @@ -0,0 +1,54 @@ +package io.github.f4pl0; + +import io.github.f4pl0.config.IEXCloudConfig; +import io.github.f4pl0.config.IEXConfiguration; +import lombok.SneakyThrows; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; + +import java.io.IOException; +import java.net.URI; + +/** + * The IEXHttpClient is a wrapper around the Apache HttpClient. + * It is used to make requests to the IEX Cloud API. + * @hidden This class is not part of the public API. DO NOT USE. + */ +public class IEXHttpClient { + private static IEXHttpClient instance; + @IEXConfiguration + private IEXCloudConfig config; + + private final CloseableHttpClient httpClient; + + private IEXHttpClient() { + this.httpClient = HttpClients.createDefault(); + } + + @SneakyThrows + public CloseableHttpResponse execute(String requestUri) { + URI uri = new URIBuilder(config.getBaseEndpoint() + requestUri) + .addParameter("token", config.getPublishableToken()) + .build(); + + HttpGet request = new HttpGet(uri); + + CloseableHttpResponse response = httpClient.execute(request); + + if (response.getStatusLine().getStatusCode() >= 400) { + throw new IOException("Request failed: " + response.getStatusLine()); + } + + return response; + } + + public static IEXHttpClient getInstance() { + if (instance == null) { + instance = new IEXHttpClient(); + } + return instance; + } +} diff --git a/src/main/java/io/github/f4pl0/Main.java b/src/main/java/io/github/f4pl0/Main.java deleted file mode 100644 index 9e6f983..0000000 --- a/src/main/java/io/github/f4pl0/Main.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.github.f4pl0; - -import io.github.f4pl0.reference.data.IEXTradingSymbol; -import lombok.SneakyThrows; - -import java.util.List; - -public class Main { - - @SneakyThrows - public static void main(String[] args) { - IEXCloudClient client = new IEXCloudClient.IEXCloudClientBuilder() - .setPublishableToken("pk_5f9b26d6d90e485a87729ac70e5978a6") - .build(); - - List symbols = client.reference.dailyIEXTradingSymbols(); - System.out.println(symbols); - } -} diff --git a/src/main/java/io/github/f4pl0/config/ConfigInjector.java b/src/main/java/io/github/f4pl0/config/ConfigInjector.java new file mode 100644 index 0000000..f34e155 --- /dev/null +++ b/src/main/java/io/github/f4pl0/config/ConfigInjector.java @@ -0,0 +1,24 @@ +package io.github.f4pl0.config; + +import lombok.SneakyThrows; + +import java.lang.reflect.Field; + +/** + * The ConfigInjector is used to inject the IEXCloudConfig into the IEXHttpClient. + * @hidden This class is not part of the public API. DO NOT USE. + */ +public class ConfigInjector { + + @SneakyThrows(IllegalAccessException.class) + public static void injectIEXConfiguration(Object instance, IEXCloudConfig config) { + Class clazz = instance.getClass(); + + for (Field field : clazz.getDeclaredFields()) { + if (field.isAnnotationPresent(IEXConfiguration.class)) { + field.setAccessible(true); + field.set(instance, config); + } + } + } +} diff --git a/src/main/java/io/github/f4pl0/config/IEXCloudConfig.java b/src/main/java/io/github/f4pl0/config/IEXCloudConfig.java new file mode 100644 index 0000000..e61942e --- /dev/null +++ b/src/main/java/io/github/f4pl0/config/IEXCloudConfig.java @@ -0,0 +1,14 @@ +package io.github.f4pl0.config; + +import lombok.Data; + +/** + * The IEXCloudConfig is used to configure the IEXCloudClient. + * @hidden This class is not part of the public API. DO NOT USE. + */ +@Data +public class IEXCloudConfig { + private String publishableToken; + private String secretToken; + private String baseEndpoint; +} \ No newline at end of file diff --git a/src/main/java/io/github/f4pl0/config/IEXConfiguration.java b/src/main/java/io/github/f4pl0/config/IEXConfiguration.java new file mode 100644 index 0000000..e1c9f41 --- /dev/null +++ b/src/main/java/io/github/f4pl0/config/IEXConfiguration.java @@ -0,0 +1,17 @@ +package io.github.f4pl0.config; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.reflect.Field; + +/** + * This annotation is used to inject the IEXConfiguration object into the class + * @hidden This class is not part of the public API. DO NOT USE. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface IEXConfiguration { +} + diff --git a/src/main/java/io/github/f4pl0/deserializer/ZeroAsFalseDeserializer.java b/src/main/java/io/github/f4pl0/deserializer/ZeroAsFalseDeserializer.java new file mode 100644 index 0000000..63dd37f --- /dev/null +++ b/src/main/java/io/github/f4pl0/deserializer/ZeroAsFalseDeserializer.java @@ -0,0 +1,28 @@ +package io.github.f4pl0.deserializer; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; + +import java.io.IOException; + +/** + * Jackson deserializer for boolean values that are represented as 0 or 1. + * @hidden This class is not part of the public API. DO NOT USE. + */ +public class ZeroAsFalseDeserializer extends JsonDeserializer { + + /** + * Deserializes a boolean value that is represented as 0 or 1. + * @param jsonParser Parser used for reading JSON content + * @param deserializationContext Context that can be used to access information about this deserialization activity. + * + * @return A boolean value. + * @throws IOException If the request fails. + */ + @Override + public Boolean deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { + int value = jsonParser.getIntValue(); + return value != 0; + } +} \ No newline at end of file diff --git a/src/main/java/io/github/f4pl0/equitiesmarketdata/EquitiesMarketData.java b/src/main/java/io/github/f4pl0/equitiesmarketdata/EquitiesMarketData.java index 2f87c6b..b910944 100644 --- a/src/main/java/io/github/f4pl0/equitiesmarketdata/EquitiesMarketData.java +++ b/src/main/java/io/github/f4pl0/equitiesmarketdata/EquitiesMarketData.java @@ -1,9 +1,7 @@ package io.github.f4pl0.equitiesmarketdata; -import io.github.f4pl0.IEXCloudConfig; +import io.github.f4pl0.config.IEXCloudConfig; import lombok.RequiredArgsConstructor; -@RequiredArgsConstructor public class EquitiesMarketData { - private final IEXCloudConfig config; } diff --git a/src/main/java/io/github/f4pl0/reference/Reference.java b/src/main/java/io/github/f4pl0/reference/Reference.java index a756266..6fd9759 100644 --- a/src/main/java/io/github/f4pl0/reference/Reference.java +++ b/src/main/java/io/github/f4pl0/reference/Reference.java @@ -1,8 +1,12 @@ package io.github.f4pl0.reference; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import io.github.f4pl0.IEXCloudConfig; -import io.github.f4pl0.reference.data.IEXTradingSymbol; +import io.github.f4pl0.IEXHttpClient; +import io.github.f4pl0.config.IEXCloudConfig; +import io.github.f4pl0.config.IEXConfiguration; +import io.github.f4pl0.reference.data.*; +import lombok.NonNull; import lombok.SneakyThrows; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -14,35 +18,349 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; -import java.util.List; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.text.ParseException; +import java.util.*; public class Reference { - private final CloseableHttpClient httpClient; - private final IEXCloudConfig config; + private final IEXHttpClient httpClient = IEXHttpClient.getInstance(); + private final ObjectMapper mapper = new ObjectMapper(); - public Reference(IEXCloudConfig config) { - this.httpClient = HttpClients.createDefault(); - this.config = config; + /** + *

Daily IEX Trading Symbols

+ * Returns an array of symbols the Investors Exchange supports for trading. Symbols may be added or removed by the + * Investors Exchange at any time. + * @see IEX Cloud API + * @throws IOException If the request fails. + * @return A list of IEXTradingSymbol objects. + */ + public List dailyIEXTradingSymbols() throws IOException { + CloseableHttpResponse response = httpClient.execute("/data/core/ref_data_iex_symbols"); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXTradingSymbol.class)); } - @SneakyThrows(URISyntaxException.class) - public List dailyIEXTradingSymbols() throws IOException { - URI uri = new URIBuilder(config.getBaseEndpoint() + "/data/core/ref_data_iex_symbols") - .addParameter("token", config.getPublishableToken()) - .build(); - HttpGet request = new HttpGet(uri); + /** + *

Forex Reference data

+ * Returns an array of the supported currencies and currency pairs. + * @see IEX Cloud API + * @throws IOException If the request fails. + * @return An IEXForexReferenceData object. + */ + public IEXForexReferenceData forexReferenceData() throws IOException { + CloseableHttpResponse response = httpClient.execute("/data/core/ref_data_fx"); + + TypeReference> typeReference = new TypeReference>() {}; + List forexData = + mapper.readValue(EntityUtils.toString(response.getEntity()), typeReference); + + return forexData.get(0); + } + + /** + *

Futures Reference Data

+ * Returns an array of the supported futures contract symbols. + * @see IEX Cloud API + * @return A list of IEXFuturesContractSymbol objects. + * @throws IOException If the request fails. + */ + public List futuresReferenceData() throws IOException { + CloseableHttpResponse response = httpClient.execute("/data/core/ref_data_futures"); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXFuturesContractSymbol.class)); + } + + /** + *

Futures Reference Data

+ * Returns an array of the supported futures contract symbols. + * @see IEX Cloud API + * @param underlying The underlying symbol of the futures contract. + * @return A list of IEXFuturesContractSymbol objects. + * @throws IOException If the request fails. + */ + public List futuresReferenceData(@NonNull String underlying) throws IOException { + String encodedUnderlying = URLEncoder.encode(underlying, StandardCharsets.UTF_8); + CloseableHttpResponse response = + httpClient.execute("/data/core/ref_data_futures/" + encodedUnderlying); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXFuturesContractSymbol.class)); + } + + /** + *

Mutual Fund Reference Data

+ * Returns an array of the supported mutual fund symbols. + * @see IEX Cloud API + * @return A list of IEXMutualFundSymbol objects. + * @throws IOException If the request fails. + */ + public List mutualFundReferenceData() throws IOException { + CloseableHttpResponse response = httpClient.execute("/data/core/ref_data_mutual_funds"); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXMutualFundSymbol.class)); + } + + /** + *

OTC Reference Data

+ * Returns an array of the supported over-the-counter (OTC) symbols. + * @see IEX Cloud API + * @return A list of IEXOTCSymbol objects. + * @throws IOException If the request fails. + */ + public List otcReferenceData() throws IOException { + CloseableHttpResponse response = httpClient.execute("/data/core/ref_data_otc"); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXOTCSymbol.class)); + } + + /** + *

Options Reference Data

+ * Returns an object keyed by symbol with the value of each symbol being an array of available contract dates. + * @see IEX Cloud API + * @return A Map of String keys and List of Date values. + * @throws IOException + */ + public Map> optionsReferenceData() throws IOException { + CloseableHttpResponse response = httpClient.execute("/data/core/ref_data_options"); + + // The response is a list of maps (for some apparent reason there is only 1 entry in the list) + // so we will get and return only the first entry. + List>> data = + mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, Map.class)); + + Map> parsedData = new HashMap<>(); + + // This here is basically just reformatting the string dates into Date objects. + for (Map.Entry> entry : data.get(0).entrySet()) { + List dates = entry.getValue(); + List parsedDates = new java.util.ArrayList<>(dates.size()); - CloseableHttpResponse response = httpClient.execute(request); + for (String date : dates) { + try { + parsedDates.add(new java.text.SimpleDateFormat("yyyyMMdd").parse(date)); + } catch (ParseException e) { + e.printStackTrace(); // TODO: Implement more robust error logging. + } + } - if (response.getStatusLine().getStatusCode() != 200) { - throw new IOException("Request failed: " + response.getStatusLine()); + parsedData.put(entry.getKey(), parsedDates); } - ObjectMapper mapper = new ObjectMapper(); + return parsedData; + } + + /** + *

Options Reference Data

+ * Returns an object keyed by symbol with the value of each symbol being an array of available contract dates. + * @see IEX Cloud API + * @param underlying The underlying symbol of the options. + * @return A List of Options for the given underlying symbols. + * @throws IOException + */ + public List optionsReferenceData(@NonNull String underlying) throws IOException { + String encodedUnderlying = URLEncoder.encode(underlying, StandardCharsets.UTF_8); + CloseableHttpResponse response = + httpClient.execute("/data/core/ref_data_options/" + encodedUnderlying); return mapper.readValue( EntityUtils.toString(response.getEntity()), - mapper.getTypeFactory().constructCollectionType(List.class, IEXTradingSymbol.class)); + mapper.getTypeFactory().constructCollectionType(List.class, IEXOption.class)); + } + + /** + *

Options Reference Data

+ * Returns an object keyed by symbol with the value of each symbol being an array of available contract dates. + * @see IEX Cloud API + * @param underlying The underlying symbol of the options. + * @param expirationDate The expiration date of the options. + * @return A List of Options for the given underlying symbol with the given expiration date. + * @throws IOException + */ + public List optionsReferenceData( + @NonNull String underlying, + @NonNull Date expirationDate + ) throws IOException { + String encodedUnderlying = URLEncoder.encode(underlying, StandardCharsets.UTF_8); + String formattedExpirationDate = new java.text.SimpleDateFormat("yyyy-MM-dd").format(expirationDate); + CloseableHttpResponse response = httpClient.execute( + "/data/core/ref_data_options/" + encodedUnderlying + "/" + formattedExpirationDate); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXOption.class)); + } + + /** + *

Options Reference Data

+ * Returns an object keyed by symbol with the value of each symbol being an array of available contract dates. + * @see IEX Cloud API + * @param underlying List of underlying symbols of the options. + * @return A List of Options for the given array of underlying symbols. + * @throws IOException + */ + public List optionsReferenceData(@NonNull String[] underlying) throws IOException { + List encodedUnderlying = new ArrayList<>(underlying.length); + for (String underlyingSymbol : underlying) { + encodedUnderlying.add(URLEncoder.encode(underlyingSymbol, StandardCharsets.UTF_8)); + } + String joinedUnderlying = String.join(",", encodedUnderlying); + CloseableHttpResponse response = + httpClient.execute("/data/core/ref_data_options/" + joinedUnderlying); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXOption.class)); + } + + /** + *

Options Reference Data

+ * Returns an object keyed by symbol with the value of each symbol being an array of available contract dates. + * @see IEX Cloud API + * @param underlying List of underlying symbols of the options. + * @param expirationDate The expiration date of the options. + * @return A List of Options for the given underlying symbols with the given expiration date. + * @throws IOException + */ + public List optionsReferenceData( + @NonNull String[] underlying, + @NonNull Date expirationDate + ) throws IOException { + List encodedUnderlying = new ArrayList<>(underlying.length); + for (String underlyingSymbol : underlying) { + encodedUnderlying.add(URLEncoder.encode(underlyingSymbol, StandardCharsets.UTF_8)); + } + String joinedUnderlying = String.join(",", encodedUnderlying); + String formattedExpirationDate = new java.text.SimpleDateFormat("yyyy-MM-dd").format(expirationDate); + CloseableHttpResponse response = httpClient.execute( + "/data/core/ref_data_options/" + joinedUnderlying + "/" + formattedExpirationDate); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXOption.class)); + } + + /** + *

Sectors Reference Data

+ * Returns an array of the sectors. + * @see IEX Cloud API + * @return A list of sectors. + * @throws IOException If the request fails. + */ + public List sectorsReferenceData() throws IOException { + CloseableHttpResponse response = httpClient.execute("/data/core/ref_data_sectors"); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXSector.class)); + } + + /** + *

Security Symbol Reference Data

+ * Returns an array of reference data for securities by symbol. Intraday price updates are tracked for these securities. + * @see IEX Cloud API + * @return A list of security symbols. + * @throws IOException If the request fails. + */ + public List securitySymbolsReferenceData() throws IOException { + CloseableHttpResponse response = httpClient.execute("/data/core/ref_data"); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXSecuritySymbol.class)); + } + + /** + *

Security Tags/Categories

+ * Returns an array of tags. Tags can be found on companies. + * @see IEX Cloud API + * @return A list of tags. + * @throws IOException If the request fails. + */ + public List securityTags() throws IOException { + CloseableHttpResponse response = httpClient.execute("/data/core/ref_data_tags"); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXSecurityTag.class)); + } + + /** + *

U.S. Exchanges

+ * Returns an array of U.S. exchanges. + * @see IEX Cloud API + * @return A list of U.S. exchanges. + * @throws IOException If the request fails. + */ + public List usExchanges() throws IOException { + CloseableHttpResponse response = httpClient.execute("/data/core/ref_data_exchanges"); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXUSExchange.class)); + } + + /** + * U.S. Holidays & Trading Dates + * Returns the next trade date + * @see IEX Cloud API + * @return The next trade date. + * @throws IOException If the request fails. + */ + public IEXTradeDate usNextTradeDate() throws IOException { + CloseableHttpResponse response = httpClient.execute("/data/core/ref_data_dates/trade/next"); + + List dates = mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXTradeDate.class)); + + return dates.get(0); + } + + /** + *

Autocomplete Search

+ * Returns an array of symbols up to the top 10 matches. Results will be sorted for relevancy. Search currently + * defaults to equities only, where the symbol returned is supported by endpoints listed under the Stocks category. + * + * This endpoint is useful for creating an autocomplete search box. + * @see IEX Cloud API + * @param fragment The fragment to search for. + * @return A list of results. + * @throws IOException If the request fails. + */ + public List search(@NonNull String fragment) throws IOException { + String encodedFragment = URLEncoder.encode(fragment, StandardCharsets.UTF_8); + CloseableHttpResponse response = httpClient.execute("/search/" + encodedFragment); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXSecuritySearchResult.class)); + } + + /** + *

International Exchanges

+ * Returns an array of reference information about securities exchanges throughout the world. + * @see IEX Cloud API + * @return A list of international exchanges. + * @throws IOException If the request fails. + */ + public List internationalExchanges() throws IOException { + CloseableHttpResponse response = httpClient.execute("/ref-data/exchanges"); + + return mapper.readValue( + EntityUtils.toString(response.getEntity()), + mapper.getTypeFactory().constructCollectionType(List.class, IEXInternationalExchange.class)); } } diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXForexCurrency.java b/src/main/java/io/github/f4pl0/reference/data/IEXForexCurrency.java new file mode 100644 index 0000000..6d1024e --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXForexCurrency.java @@ -0,0 +1,23 @@ +package io.github.f4pl0.reference.data; + + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import io.github.f4pl0.deserializer.ZeroAsFalseDeserializer; + +public class IEXForexCurrency { + /** + * Refers to the symbol of the currency. + */ + public String code; + + /** + * Refers to the name of the currency. + */ + public String name; + + /** + * If the currency is crypto. + */ + @JsonDeserialize(using = ZeroAsFalseDeserializer.class) + public boolean isCrypto; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXForexCurrencyPair.java b/src/main/java/io/github/f4pl0/reference/data/IEXForexCurrencyPair.java new file mode 100644 index 0000000..8ef1005 --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXForexCurrencyPair.java @@ -0,0 +1,32 @@ +package io.github.f4pl0.reference.data; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import io.github.f4pl0.deserializer.ZeroAsFalseDeserializer; + +public class IEXForexCurrencyPair { + /** + * Refers to the symbol of the currency from which the conversion is made. + */ + public String fromCurrency; + + /** + * Refers to the symbol of the currency to which the conversion is made. + */ + public String toCurrency; + + /** + * Refers to the symbol of the currency pair. + */ + public String symbol; + + /** + * Refers to the name of the currency pair. + */ + public String name; + + /** + * If the currency is crypto. + */ + @JsonDeserialize(using = ZeroAsFalseDeserializer.class) + public Boolean isCrypto; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXForexReferenceData.java b/src/main/java/io/github/f4pl0/reference/data/IEXForexReferenceData.java new file mode 100644 index 0000000..df035d9 --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXForexReferenceData.java @@ -0,0 +1,16 @@ +package io.github.f4pl0.reference.data; + +import java.util.List; + +public class IEXForexReferenceData { + /** + * Array of all the supported currencies. Each currency is an object containing a code, a name, and an isCrypto + * indicator. + */ + public List currencies; + + /** + * Array of all the supported currency pairs. Each pair is an object containing from code and to code. + */ + public List pairs; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXFuturesContractSymbol.java b/src/main/java/io/github/f4pl0/reference/data/IEXFuturesContractSymbol.java new file mode 100644 index 0000000..a5d3e1f --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXFuturesContractSymbol.java @@ -0,0 +1,69 @@ +package io.github.f4pl0.reference.data; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.util.Date; + +public class IEXFuturesContractSymbol { + /** + * ISO 10962 Classification of Financial Instruments code + */ + public String efiCode; + + /** + * Lot size of the security + */ + public Integer contractSize; + + /** + * Currency the security is traded in + */ + public String currency; + + /** + * Date the security reference data was generated, + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + public Date date; + + /** + * Exchange acronym + */ + public String exchange; + + /** + * Name of the exchange + */ + public String exchangeName; + + /** + * Expiration of the security, + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + public String expirationDate; + + /** + * OpenFIGI id for the security, if available + */ + public String figi; + + /** + * Name of the security + */ + public String name; + + /** + * Region of the world the security is in + */ + public String region; + + /** + * Futures symbol + */ + public String symbol; + + /** + * Underlying asset shortname + */ + public String underlying; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXInternationalExchange.java b/src/main/java/io/github/f4pl0/reference/data/IEXInternationalExchange.java new file mode 100644 index 0000000..5c3a6f9 --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXInternationalExchange.java @@ -0,0 +1,30 @@ +package io.github.f4pl0.reference.data; + +public class IEXInternationalExchange { + /** + * Exchange abbreviation + */ + public String exchange; + + /** + * 2 letter case-insensitive string of country codes using ISO 3166-1 alpha-2 + * @see ISO 3166-1 alpha-2 + */ + public String region; + + /** + * Full name of the exchange + */ + public String description; + + /** + * Market Identifier Code using ISO 10383 + * @see ISO 10383 + */ + public String mic; + + /** + * Exchange Suffix to be added for symbols on that exchange + */ + public String exchangeSuffix; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXMutualFundSymbol.java b/src/main/java/io/github/f4pl0/reference/data/IEXMutualFundSymbol.java new file mode 100644 index 0000000..05761d6 --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXMutualFundSymbol.java @@ -0,0 +1,94 @@ +package io.github.f4pl0.reference.data; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.util.Date; + +public class IEXMutualFundSymbol { + /** + * Central Index Key (CIK), if available for the company. The CIK is used to identify entities that are regulated + * by the Securities and Exchange Commission (SEC) + */ + public String cik; + + /** + * Currency the symbol is traded in using ISO 4217 + * @see ISO 4217 + */ + public String currency; + + /** + * Date the symbol reference data was generated + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + public Date date; + + /** + * Exchange symbol + * @see IEX Supported Exchanges list + */ + public String exchange; + + /** + * Exchange name + */ + public String exchangeName; + + /** + * Exchange segment + */ + public String exchangeSegment; + + /** + * Exchange segment name + */ + public String exchangeSegmentName; + + /** + * Exchange suffix + */ + public String exchangeSuffix; + + /** + * OpenFIGI id for the security, if available + */ + public String figi; + + /** + * Unique ID applied by IEX to track securities through symbol changes + */ + public String iexId; + + /** + * true if the symbol is enabled for trading on IEX + */ + public boolean isEnabled; + + /** + * Legal Entity Identifier (LEI) for the security, if available + */ + public String lei; + + /** + * Name of the company or security + */ + public String name; + + /** + * Country code for the symbol using ISO 3166-1 alpha-2 + * @see ISO 3166-1 alpha-2 + */ + public String region; + + /** + * Symbol represented in Nasdaq Integrated symbology (INET) + * @see Nasdaq Integrated symbology (INET) + */ + public String symbol; + + /** + * Common issue type
+ * OEF - Open Ended + */ + public String type; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXOTCSymbol.java b/src/main/java/io/github/f4pl0/reference/data/IEXOTCSymbol.java new file mode 100644 index 0000000..ee2690a --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXOTCSymbol.java @@ -0,0 +1,105 @@ +package io.github.f4pl0.reference.data; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.util.Date; + +public class IEXOTCSymbol { + /** + * Central Index Key (CIK), if available for the company. The CIK is used to identify entities that are regulated + * by the Securities and Exchange Commission (SEC) + */ + public String cik; + + /** + * Currency the symbol is traded in using ISO 4217 + * @see ISO 4217 + */ + public String currency; + + /** + * Date the symbol reference data was generated + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + public Date date; + + /** + * Exchange symbol + * @see IEX Supported Exchanges list + */ + public String exchange; + + /** + * Exchange name + */ + public String exchangeName; + + /** + * Exchange segment + */ + public String exchangeSegment; + + /** + * Exchange segment name + */ + public String exchangeSegmentName; + + /** + * Exchange suffix + */ + public String exchangeSuffix; + + /** + * OpenFIGI id for the security, if available + */ + public String figi; + + /** + * Unique ID applied by IEX to track securities through symbol changes + */ + public String iexId; + + /** + * true if the symbol is enabled for trading on IEX + */ + public boolean isEnabled; + + /** + * Legal Entity Identifier (LEI) for the security, if available + */ + public String lei; + + /** + * Name of the company or security + */ + public String name; + + /** + * Country code for the symbol using ISO 3166-1 alpha-2 + * @see ISO 3166-1 alpha-2 + */ + public String region; + + /** + * Symbol represented in Nasdaq Integrated symbology (INET) + * @see Nasdaq Integrated symbology (INET) + */ + public String symbol; + + /** + * Common issue type
+ * ad - ADR
+ * cs - Common Stock
+ * cef - Closed End Fund
+ * et - ETF
+ * oef - Open Ended Fund
+ * ps - Preferred Stock
+ * rt - Right
+ * struct - Structured Product
+ * ut - Unit
+ * wi - When Issued
+ * wt - Warrant
+ * empty - Other + */ + public String type; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXOption.java b/src/main/java/io/github/f4pl0/reference/data/IEXOption.java new file mode 100644 index 0000000..233d6b6 --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXOption.java @@ -0,0 +1,95 @@ +package io.github.f4pl0.reference.data; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.math.BigDecimal; +import java.util.Date; + +public class IEXOption { + /** + * The symbol of the underlying equity. + */ + public String symbol; + + /** + * The date of the option. + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + public Date date; + + /** + * Name of the company or index. + */ + public String name; + + /** + * Option description. + */ + public String description; + + /** + * Date of expiration + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + public Date expirationDate; + + /** + * Type of option. + */ + public String type; + + /** + * Option side. + */ + public String side; + + /** + * Exercise style of option. + */ + public String exercise; + + /** + * Option strike price. + */ + public BigDecimal strike; + + /** + * Underlying component security. + */ + public String underlying; + + /** + * Region of the underlying equity. + */ + public String region; + + /** + * Currency of the underlying equity. + */ + public String currency; + + /** + * Figi of the underlying equity. + */ + public String figi; + + /** + * Contract size of the underlying equity. + */ + public BigDecimal contractSize; + + /** + * CFI code of the underlying equity. + */ + public String cfiCode; + + /** + * Exchange traded on. + */ + public String exchange; + + /** + * Exchange name + */ + public String exchangeName; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXSector.java b/src/main/java/io/github/f4pl0/reference/data/IEXSector.java new file mode 100644 index 0000000..58c8a83 --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXSector.java @@ -0,0 +1,8 @@ +package io.github.f4pl0.reference.data; + +public class IEXSector { + /** + * Sector name + */ + public String name; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXSecuritySearchResult.java b/src/main/java/io/github/f4pl0/reference/data/IEXSecuritySearchResult.java new file mode 100644 index 0000000..cc32656 --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXSecuritySearchResult.java @@ -0,0 +1,54 @@ +package io.github.f4pl0.reference.data; + +public class IEXSecuritySearchResult { + /** + * Refers to the symbol represented in Nasdaq Integrated symbology (INET). + * @see Nasdaq Integrated symbology (INET) + */ + public String symbol; + + /** + * Refers to the unique identifier for this data set, the Central Index Key (CIK) + * is used to identify entities that are regulated by the Securities and Exchange Commission (SEC). + */ + public String cik; + + /** + * Name of the security + */ + public String securityName; + + /** + * Common issue type
+ * ad - ADR
+ * cs - Common Stock
+ * cef - Closed End Fund
+ * et - ETF
+ * oef - Open Ended Fund
+ * ps - Preferred Stock
+ * rt - Right
+ * struct - Structured Product
+ * ut - Unit
+ * wi - When Issued
+ * wt - Warrant
+ * empty - Other + */ + public String securityType; + + /** + * Refers to the country code for the symbol using ISO 3166-1 alpha-2 + * @see ISO 3166-1 alpha-2 + */ + public String region; + + /** + * Refers to an IEX Cloud Supported Exchange + * @see Supported Exchanges + */ + public String exchange; + + /** + * Refers to the sector the security belongs to. + */ + public String sector; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXSecuritySymbol.java b/src/main/java/io/github/f4pl0/reference/data/IEXSecuritySymbol.java new file mode 100644 index 0000000..18b9951 --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXSecuritySymbol.java @@ -0,0 +1,105 @@ +package io.github.f4pl0.reference.data; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.util.Date; + +public class IEXSecuritySymbol { + /** + * Central Index Key (CIK), if available for the company. The CIK is used to identify entities that are regulated + * by the Securities and Exchange Commission (SEC) + */ + public String cik; + + /** + * Currency the symbol is traded in using ISO 4217 + * @see ISO 4217 + */ + public String currency; + + /** + * Date the symbol reference data was generated + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + public Date date; + + /** + * Exchange symbol + * @see IEX Supported Exchanges list + */ + public String exchange; + + /** + * Exchange name + */ + public String exchangeName; + + /** + * Exchange segment + */ + public String exchangeSegment; + + /** + * Exchange segment name + */ + public String exchangeSegmentName; + + /** + * Exchange suffix + */ + public String exchangeSuffix; + + /** + * OpenFIGI id for the security, if available + */ + public String figi; + + /** + * Unique ID applied by IEX to track securities through symbol changes + */ + public String iexId; + + /** + * true if the symbol is enabled for trading on IEX + */ + public boolean isEnabled; + + /** + * Legal Entity Identifier (LEI) for the security, if available + */ + public String lei; + + /** + * Name of the company or security + */ + public String name; + + /** + * Country code for the symbol using ISO 3166-1 alpha-2 + * @see ISO 3166-1 alpha-2 + */ + public String region; + + /** + * Symbol represented in Nasdaq Integrated symbology (INET) + * @see Nasdaq Integrated symbology (INET) + */ + public String symbol; + + /** + * Common issue type
+ * ad - ADR
+ * cs - Common Stock
+ * cef - Closed End Fund
+ * et - ETF
+ * oef - Open Ended Fund
+ * ps - Preferred Stock
+ * rt - Right
+ * struct - Structured Product
+ * ut - Unit
+ * wi - When Issued
+ * wt - Warrant
+ * empty - Other + */ + public String type; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXSecurityTag.java b/src/main/java/io/github/f4pl0/reference/data/IEXSecurityTag.java new file mode 100644 index 0000000..a9e7553 --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXSecurityTag.java @@ -0,0 +1,8 @@ +package io.github.f4pl0.reference.data; + +public class IEXSecurityTag { + /** + * Tag name + */ + public String name; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXTradeDate.java b/src/main/java/io/github/f4pl0/reference/data/IEXTradeDate.java new file mode 100644 index 0000000..2064719 --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXTradeDate.java @@ -0,0 +1,17 @@ +package io.github.f4pl0.reference.data; + +import com.fasterxml.jackson.annotation.JsonFormat; + +public class IEXTradeDate { + /** + * Trade date + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + public String date; + + /** + * Settlement date + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + public String settlementDate; +} diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXTradingSymbol.java b/src/main/java/io/github/f4pl0/reference/data/IEXTradingSymbol.java index e3393a8..e8c4608 100644 --- a/src/main/java/io/github/f4pl0/reference/data/IEXTradingSymbol.java +++ b/src/main/java/io/github/f4pl0/reference/data/IEXTradingSymbol.java @@ -4,9 +4,6 @@ import java.util.Date; -/** - * Represents a symbol reference data. - */ public class IEXTradingSymbol { /** * Refers to the symbol represented in Nasdaq Integrated symbology (INET). diff --git a/src/main/java/io/github/f4pl0/reference/data/IEXUSExchange.java b/src/main/java/io/github/f4pl0/reference/data/IEXUSExchange.java new file mode 100644 index 0000000..39ddf9c --- /dev/null +++ b/src/main/java/io/github/f4pl0/reference/data/IEXUSExchange.java @@ -0,0 +1,41 @@ +package io.github.f4pl0.reference.data; + +public class IEXUSExchange { + /** + * Full name of the exchange. + */ + public String longName; + + /** + * Market identifier code for the exchange. + * @see MIC + */ + public String mic; + + /** + * Short name of the exchange. + */ + public String name; + + /** + * FINRA OATS exchange participant ID. + * @see FINRA OATS + */ + public String oatsId; + + /** + * ID used to map exchange across individual markets. Useful when mapping ISIN. + */ + public String refId; + + /** + * ID used to identify the exchange on the Consolidated Tape. + * @see Consolidated Tape + */ + public String tapeId; + + /** + * Type of securities traded by the exchange. + */ + public String type; +}