Fund the fee pool of an asset
483017
def fundfeepool(ctx, symbol, amount, account):
    
    print_tx(ctx.bitshares.fund_fee_pool(symbol, amount, account=account))
693873
def process_commission(self, commission):
        
        asset = commission['asset']
        cost = commission['cost']

        self.position_tracker.handle_commission(asset, cost)
        self._cash_flow(-cost)
903580
def use_plenary_asset_view(self):
        """"""
        self._object_views['asset'] = PLENARY
        # self._get_provider_session('asset_lookup_session') # To make sure the session is tracked
        for session in self._get_provider_sessions():
            try:
                session.use_plenary_asset_view()
            except AttributeError:
                pass
793987
def update_portfolio(self):
        
        if not self._dirty_portfolio:
            return

        portfolio = self._portfolio
        pt = self.position_tracker

        portfolio.positions = pt.get_positions()
        position_stats = pt.stats

        portfolio.positions_value = position_value = (
            position_stats.net_value
        )
        portfolio.positions_exposure = position_stats.net_exposure
        self._cash_flow(self._get_payout_total(pt.positions))

        start_value = portfolio.portfolio_value

        # update the new starting value
        portfolio.portfolio_value = end_value = portfolio.cash + position_value

        pnl = end_value - start_value
        if start_value != 0:
            returns = pnl / start_value
        else:
            returns = 0.0

        portfolio.pnl += pnl
        portfolio.returns = (
            (1 + portfolio.returns) *
            (1 + returns) -
            1
        )

        # the portfolio has been fully synced
        self._dirty_portfolio = False
997862
function readFundedAndSigningAddresses(
		asset, wallet, estimated_amount, spend_unconfirmed, fee_paying_wallet,
		arrSigningAddresses, arrSigningDeviceAddresses, handleFundedAndSigningAddresses)
{
	readFundedAddresses(asset, wallet, estimated_amount, spend_unconfirmed, function(arrFundedAddresses){
		if (arrFundedAddresses.length === 0)
			return handleFundedAndSigningAddresses([], [], []);
		var arrBaseFundedAddresses = [];
		var addSigningAddressesAndReturn = function(){
			var arrPayingAddresses = _.union(arrFundedAddresses, arrBaseFundedAddresses);
			readAdditionalSigningAddresses(arrPayingAddresses, arrSigningAddresses, arrSigningDeviceAddresses, function(arrAdditionalAddresses){
				handleFundedAndSigningAddresses(arrFundedAddresses, arrBaseFundedAddresses, arrSigningAddresses.concat(arrAdditionalAddresses));
			});
		};
		if (!asset)
			return addSigningAddressesAndReturn();
		readFundedAddresses(null, wallet, TYPICAL_FEE, spend_unconfirmed, function(_arrBaseFundedAddresses){
			// fees will be paid from the same addresses as the asset
			if (_arrBaseFundedAddresses.length > 0 || !fee_paying_wallet || fee_paying_wallet === wallet){
				arrBaseFundedAddresses = _arrBaseFundedAddresses;
				return addSigningAddressesAndReturn();
			}
			readFundedAddresses(null, fee_paying_wallet, TYPICAL_FEE, spend_unconfirmed, function(_arrBaseFundedAddresses){
				arrBaseFundedAddresses = _arrBaseFundedAddresses;
				addSigningAddressesAndReturn();
			});
		});
	});
}
263814
def SetBalanceFor(self, assetId, fixed8_val):
        
        found = False
        for key, val in self.Balances.items():
            if key == assetId:
                self.Balances[key] = fixed8_val
                found = True

        if not found:
            self.Balances[assetId] = fixed8_val
320537
def update_lbaas_pool(self, lbaas_pool, body=None):
        """"""
        return self.put(self.lbaas_pool_path % (lbaas_pool),
                        body=body)
93905
def profit_money(self):
        

        return float(round(self.assets.iloc[-1] - self.assets.iloc[0], 2))
586834
def submit(cls, client, direction, legs, price, quantity, time_in_force,
               trigger, order_type, run_validations=True):
        '''
        
        '''

        if run_validations:
            assert(direction in ["debit", "credit"])
            assert(type(price) is str)
            assert(type(quantity) is int)
            assert(time_in_force in ["gfd", "gtc"])
            assert(trigger in ["immediate"])
            assert(order_type in ["limit", "market"])
            assert(cls._validate_legs(legs) is True)

        payload = json.dumps({
            "account": client.account_url,
            "direction": direction,
            "legs": legs,
            "price": price,
            "quantity": quantity,
            "time_in_force": time_in_force,
            "trigger": trigger,
            "type": order_type,
            "override_day_trade_checks": False,
            "override_dtbp_checks": False,
            "ref_id": str(uuid.uuid4())
        })

        request_url = "https://api.robinhood.com/options/orders/"
        data = client.post(request_url, payload=payload)
        return data
7743
public void set(String name, boolean deposit, boolean withdraw, boolean acl, boolean show, boolean owner) {
        String newName = name.toLowerCase();
        aclList.put(name, Common.getInstance().getStorageHandler().getStorageEngine().saveACL(account, newName, deposit, withdraw, acl, show, owner));
    }
151073
function SimplePool() {
    var args;
    args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
    this.current = 0;
    this.pool = args.length === 1 && Array.isArray(args[0]) ? args[0] : args;
  }
786077
function readFundedAddresses(asset, amount, arrAvailablePayingAddresses, arrAvailableFeePayingAddresses, spend_unconfirmed, handleFundedAddresses){
	readAddressesFundedInAsset(asset, amount, spend_unconfirmed, arrAvailablePayingAddresses, function(arrAddressesFundedInAsset){
		// add other addresses to pay for commissions (in case arrAddressesFundedInAsset don't have enough bytes to pay commissions)
	//	var arrOtherAddresses = _.difference(arrAvailablePayingAddresses, arrAddressesFundedInAsset);
	//	if (arrOtherAddresses.length === 0)
	//		return handleFundedAddresses(arrAddressesFundedInAsset);
		composer.readSortedFundedAddresses(null, arrAvailableFeePayingAddresses, TYPICAL_FEE, spend_unconfirmed, function(arrFundedFeePayingAddresses){
		//	if (arrFundedOtherAddresses.length === 0)
		//		return handleFundedAddresses(arrAddressesFundedInAsset);
		//	handleFundedAddresses(arrAddressesFundedInAsset.concat(arrFundedOtherAddresses));
			if (arrFundedFeePayingAddresses.length === 0)
				throw new Error("no funded fee paying addresses out of "+arrAvailableFeePayingAddresses.join(', '));
			handleFundedAddresses(arrAddressesFundedInAsset, arrFundedFeePayingAddresses);
		});
	});
}
1141538
def reserve(ctx, amount, symbol, account):
    
    print_tx(
        ctx.bitshares.reserve(
            Amount(amount, symbol, bitshares_instance=ctx.bitshares), account=account
        )
    )
180852
def buy(self, security, price=0, amount=0, volume=0, entrust_prop=0):
        
        return self._trade(security, price, amount, volume, "buy")
308062
def calculate(self, order, transaction):
        
        cost_per_share = transaction.price * self.cost_per_dollar
        return abs(transaction.amount) * cost_per_share
694310
def buy_asset():
    
    ConfigProvider.set_config(ExampleConfig.get_config())
    config = ConfigProvider.get_config()

    # make ocean instance
    ocn = Ocean()
    acc = get_publisher_account(config)
    if not acc:
        acc = ([acc for acc in ocn.accounts.list() if acc.password] or ocn.accounts.list())[0]

    # Register ddo
    ddo = ocn.assets.create(Metadata.get_example(), acc, providers=[acc.address], use_secret_store=False)
    logging.info(f'registered ddo: {ddo.did}')
    # ocn here will be used only to publish the asset. Handling the asset by the publisher
    # will be performed by the Brizo server running locally
    keeper = Keeper.get_instance()
    if 'TEST_LOCAL_NILE' in os.environ and os.environ['TEST_LOCAL_NILE'] == '1':
        provider = keeper.did_registry.to_checksum_address(
            '0x413c9ba0a05b8a600899b41b0c62dd661e689354'
        )
        keeper.did_registry.add_provider(ddo.asset_id, provider, acc)
        logging.debug(f'is did provider: '
                      f'{keeper.did_registry.is_did_provider(ddo.asset_id, provider)}')

    cons_ocn = Ocean()
    consumer_account = get_account_from_config(config, 'parity.address1', 'parity.password1')

    # sign agreement using the registered asset did above
    service = ddo.get_service(service_type=ServiceTypes.ASSET_ACCESS)
    # This will send the order request to Brizo which in turn will execute the agreement on-chain
    cons_ocn.accounts.request_tokens(consumer_account, 100)
    sa = ServiceAgreement.from_service_dict(service.as_dictionary())

    agreement_id = cons_ocn.assets.order(
        ddo.did, sa.service_definition_id, consumer_account)
    logging.info('placed order: %s, %s', ddo.did, agreement_id)
    i = 0
    while ocn.agreements.is_access_granted(
            agreement_id, ddo.did, consumer_account.address) is not True and i < 30:
        time.sleep(1)
        i += 1

    assert ocn.agreements.is_access_granted(agreement_id, ddo.did, consumer_account.address)

    ocn.assets.consume(
        agreement_id,
        ddo.did,
        sa.service_definition_id,
        consumer_account,
        config.downloads_path)
    logging.info('Success buying asset.')
1340375
def trading_fees(self) -> TradingFees:
        """"""
        return self._fetch('trading fees', self.market.code)(self._trading_fees)()