<commit_before>/*
Copyright 2015 <NAME>

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.
*/

package models

import akka.actor.Props

import scala.collection.mutable


/** Central counter party (CCP) clearing mechanism.
  *
  * @note The key difference between CCP clearing and bilateral clearing is that
  * CCP inserts itself as the counter-party to both the ask and the bid
  * trading parties before processing the final transaction. By acting as
  * a counter-party to every transaction, the CCP assumes all counter-party
  * risk.
  */
class CCPClearingMechanism extends ClearingMechanismLike with
  CashHolder with
  SecuritiesHolder {

  /* For now assume that central counter party has "deep pockets". */
  var cash: Double = Double.PositiveInfinity

  /* For now assume that central counter party can take negative asset positions. */
  val securities: mutable.Map[Security, Int] = mutable.Map[Security, Int]().withDefaultValue(0)

  /** Central counter-party (CCP) clearing mechanism behavior. */
  val clearingMechanismBehavior: Receive = {

      case PartialFill(askTradingPartyRef, bidTradingPartyRef, instrument, price, quantity) =>

        // insert self as counter party to the bid trading party
        val askTransactionHandler = context.actorOf(Props[TransactionHandler])<commit_msg>Trait names should be adjectives.<commit_after>/*
Copyright 2015 <NAME>

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.
*/

package models

import akka.actor.Props

import scala.collection.mutable


/** Central counter party (CCP) clearing mechanism.
  *
  * @note The key difference between CCP clearing and bilateral clearing is that
  * CCP inserts itself as the counter-party to both the ask and the bid
  * trading parties before processing the final transaction. By acting as
  * a counter-party to every transaction, the CCP assumes all counter-party
  * risk.
  */
class CCPClearingMechanism extends ClearingMechanismLike with
  CashHolderLike with
  SecuritiesHolderLike {

  /* For now assume that central counter party has "deep pockets". */
  var cash: Double = Double.PositiveInfinity

  /* For now assume that central counter party can take negative asset positions. */
  val securities: mutable.Map[Security, Int] = mutable.Map[Security, Int]().withDefaultValue(0)

  /** Central counter-party (CCP) clearing mechanism behavior. */
  val clearingMechanismBehavior: Receive = {

      case PartialFill(askTradingPartyRef, bidTradingPartyRef, instrument, price, quantity) =>

        // insert self as counter party to the bid trading party
        val askTransactionHandler = context.actorOf(Props[TransactionHandler])
{'fraction_non_alphanumeric': 0.06560580681183696, 'fraction_numerical': 0.005025125628140704, 'mean_word_length': 4.25366568914956, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2999542', 'n_tokens_mistral': 938, 'n_tokens_neox': 895, 'n_words': 419}