diff --git a/README.md b/README.md index abab345..7cb49e5 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ The diagram below describes a potential integration pattern where CapitalIQ data - with yaml config: ```sh - java -jar ./capitaliq/target/scala-3.0.0-RC2/capitaliq-assembly-0.1.1.jar apply ./data/revReport.yml + java -jar ./capitaliq/target/scala-3.0.0-RC2/qt-integrations-0.1.2.jar apply ./data/revReport.yml ``` Check out the [config file](./data/revReport.yml) @@ -36,14 +36,14 @@ The diagram below describes a potential integration pattern where CapitalIQ data - with CLI args: ```sh - cat ./data/capitaliq-identifiers.txt | java -jar ./capitaliq/target/scala-3.0.0-RC2/capitaliq-assembly-0.1.1.jar generateRevenueReport --orgId c-my-small-insuranc-ltdzfd --datasetId d-e4tf3yyxerabcvicidv5oyey --currency USD --from 1988-12-31 --to 2018-12-31 + cat ./data/capitaliq-identifiers.txt | java -jar ./capitaliq/target/scala-3.0.0-RC2/qt-integrations-0.1.2.jar generateRevenueReport --orgId c-my-small-insuranc-ltdzfd --datasetId d-e4tf3yyxerabcvicidv5oyey --currency USD --from 1988-12-31 --to 2018-12-31 ``` - Generating a multi-data point report for a single date with multiple Capital IQ mnemonics and uploading it to the Quantemplate dataset - with yaml config: ```sh - java -jar ./capitaliq/target/scala-3.0.0-RC2/capitaliq-assembly-0.1.1.jar apply ./data/multiPointReport.yml + java -jar ./capitaliq/target/scala-3.0.0-RC2/qt-integrations-0.1.2.jar apply ./data/multiPointReport.yml ``` Check out the [config file](./data/multiPointReport.yml) diff --git a/build.sbt b/build.sbt index d9777c0..8cc8fea 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ name := "api-integrations" ThisBuild / organization := "com.quantemplate" ThisBuild / scalaVersion := "3.0.0-RC2" -ThisBuild / version := "0.1.1" +ThisBuild / version := "0.1.2" val AkkaVersion = "2.6.12" val AkkaHttpVersion = "10.2.4" @@ -45,6 +45,7 @@ lazy val capitaliq = (project in file("capitaliq")) ), assembly / mainClass := Some("com.quantemplate.capitaliq.Main"), + assembly / assemblyJarName := s"qt-integrations-${version.value}.jar" ) Compile / run / fork := true diff --git a/capitaliq/src/main/scala/com/quantemplate/capitaliq/commands/mutlidatapointreport/MultiDataPointReport.scala b/capitaliq/src/main/scala/com/quantemplate/capitaliq/commands/mutlidatapointreport/MultiDataPointReport.scala index 650b085..02703d5 100644 --- a/capitaliq/src/main/scala/com/quantemplate/capitaliq/commands/mutlidatapointreport/MultiDataPointReport.scala +++ b/capitaliq/src/main/scala/com/quantemplate/capitaliq/commands/mutlidatapointreport/MultiDataPointReport.scala @@ -81,6 +81,9 @@ class MultiDataPointReport(capitalIqService: CapitalIQService, qtService: QTServ case ColumnDef("IQ_ULT_PARENT", _) => IQ_ULT_PARENT.apply + case ColumnDef("IQ_ULT_PARENT_CIQID", _) => + IQ_ULT_PARENT_CIQID.apply + case ColumnDef("IQ_COMPANY_ID", _) => id => IQ_COMPANY_ID( diff --git a/capitaliq/src/main/scala/com/quantemplate/capitaliq/commands/mutlidatapointreport/MultiDataPointReportCmd.scala b/capitaliq/src/main/scala/com/quantemplate/capitaliq/commands/mutlidatapointreport/MultiDataPointReportCmd.scala index 8f234d8..1671187 100644 --- a/capitaliq/src/main/scala/com/quantemplate/capitaliq/commands/mutlidatapointreport/MultiDataPointReportCmd.scala +++ b/capitaliq/src/main/scala/com/quantemplate/capitaliq/commands/mutlidatapointreport/MultiDataPointReportCmd.scala @@ -4,6 +4,8 @@ import java.nio.file.Path import akka.actor.typed.ActorSystem import akka.actor.typed.scaladsl.Behaviors import scala.concurrent.ExecutionContext +import scala.util.{Failure, Success} +import org.slf4j.LoggerFactory import com.quantemplate.capitaliq.common.{Config, HttpService} import com.quantemplate.capitaliq.domain.CapitalIQService @@ -17,6 +19,8 @@ class MultiDataPointReportCmd: private given system: ActorSystem[Nothing] = ActorSystem(Behaviors.empty, "capitaliq") private given ExecutionContext = system.executionContext + private lazy val logger = LoggerFactory.getLogger(getClass) + private val httpService = HttpService() private val qtService = QTService(httpService) private val identifiersLoader = IdentifierLoader(qtService) @@ -31,4 +35,17 @@ class MultiDataPointReportCmd: .map(run) private def run(config: CmdConfig) = - multiDataReport.generateSpreadSheet(config) + if config.identifiers.isEmpty then + logger.error("No valid CapitalIQ identifiers were provided. Aborting") + Runtime.getRuntime.halt(1) + + multiDataReport + .generateSpreadSheet(config) + .onComplete { + case Failure(e) => + logger.error("Failed to generate a multi data point report", e) + Runtime.getRuntime.halt(1) + + case Success(_) => + Runtime.getRuntime.halt(0) + } diff --git a/capitaliq/src/main/scala/com/quantemplate/capitaliq/domain/CapitalIQ.scala b/capitaliq/src/main/scala/com/quantemplate/capitaliq/domain/CapitalIQ.scala index af04d6d..b31fa15 100644 --- a/capitaliq/src/main/scala/com/quantemplate/capitaliq/domain/CapitalIQ.scala +++ b/capitaliq/src/main/scala/com/quantemplate/capitaliq/domain/CapitalIQ.scala @@ -179,6 +179,14 @@ object CapitalIQ: ( "GDSP", m.identifier.unwrap, "IQ_ULT_PARENT" ) } + case class IQ_ULT_PARENT_CIQID(identifier: Identifier) extends Mnemonic: + def name = productPrefix + object IQ_ULT_PARENT_CIQID: + given Encoder[IQ_ULT_PARENT_CIQID] = + Encoder.forProduct3("function", "identifier", "mnemonic") { m => + ( "GDSP", m.identifier.unwrap, "IQ_ULT_PARENT_CIQID" ) + } + case class IQ_COMPANY_ID(properties: IQ_COMPANY_ID.Fn, identifier: Identifier) extends Mnemonic: def name = productPrefix object IQ_COMPANY_ID: @@ -1418,6 +1426,7 @@ object CapitalIQ: case m: IQ_COMPANY_NAME_LONG => m.asJson case m: IQ_COMPANY_ID => m.asJson case m: IQ_ULT_PARENT => m.asJson + case m: IQ_ULT_PARENT_CIQID => m.asJson case m: IQ_MARKETCAP => m.asJson case m: IQ_NI => m.asJson case m: IQ_TOTAL_EMPLOYEES => m.asJson diff --git a/data/multiPointReport.yml b/data/multiPointReport.yml index 87c260b..ae4bc97 100644 --- a/data/multiPointReport.yml +++ b/data/multiPointReport.yml @@ -7,7 +7,7 @@ params: date: 2021-05-05 identifiers: distinct: true - limit: 30 + limit: 9 dataset: datasetId: d-vvgqdpct2jh3ys3c4iuncyjh columnName: Company ID @@ -15,8 +15,8 @@ params: - IQ_COMPANY_NAME_LONG - IQ_COMPANY_ID - IQ_ULT_PARENT + - IQ_ULT_PARENT_CIQID - IQ_TOTAL_REV - IQ_MARKETCAP - IQ_NI - - IQ_EBITDA - IQ_TOTAL_EMPLOYEES