# liminal.market

> Main package for liminal.market. Use this package to register and trade securities

Latest version **1.0.3** (published 2023-04-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install liminal.market
pnpm add liminal.market
yarn add liminal.market
bun add liminal.market
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-04-11 |
| First published | 2023-02-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 90.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ingig |

## Links

- npm: https://www.npmjs.com/package/liminal.market
- npm.io page: https://npm.io/package/liminal.market

## Dependencies (8)

- [ethers](https://npm.io/package/ethers.md) ^5.7.2
- [ts-node](https://npm.io/package/ts-node.md) ^10.9.1
- [ts-loader](https://npm.io/package/ts-loader.md) ^9.4.2
- [@types/node](https://npm.io/package/@types/node.md) ^18.13.0
- [eventsource](https://npm.io/package/eventsource.md) ^2.0.2
- [@automapper/core](https://npm.io/package/@automapper/core.md) ^8.7.7
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13
- [@automapper/classes](https://npm.io/package/@automapper/classes.md) ^8.7.7

## Recent versions

- 1.0.3 (latest) — 2023-04-11
- 1.0.2 — 2023-03-02
- 1.0.1 — 2023-03-01
- 1.0.0 — 2023-02-18

## README

# Liminal.market core library

This library allows you to interact with liminal.market. Register user,
list available stocks and ETFs, and buy and sell securities on the stock market.

## Documentation
You can find documentation at https://docs.liminal.market

## Install
```
    npm install liminal.market
```

## Example
```javascript
    //import the library into our code
    import LiminalMarket from 'liminal.market';

    //start to load your private key, wallet provider and set variable for you eth address
    const provider = {}; //window.ethereum or load your private key into web3provider
    
    //To take service fee, register at https://liminal.market/contract.html
    //After registration you get a contract address you can use.
    const myContractAddress = '0x....';
    
    //initiate LiminalMarket class. myContractAddress is optional
    const liminalMarket = await LiminalMarket.getInstance(provider, myContractAddress);
    if (!liminalMarket.hasAccount()) {
        //start by registering you account, you only need to do this one time
        //you will receive aUSD when you register, so you can trade immediately
        let response = await liminalMarket.createSandboxAccount(firstName, lastName, email, async () => {
            //Wait for about 5 minutes, that is the time it takes to register with the broker and to receive aUSD.
            //You will receive email when your account is ready
        });
        console.log('create account response', response);
    }
    
    
    //check if the account has valid KYC. Not trades can be done until it's valid
    let isValidKyc = await liminalMarket.isValidKyc();
    console.log('isValidKyc', isValidKyc);

    //we can check the aUSD balance, when we have balance on it, we can trade
    const aUsdBalance = await liminalMarket.getAUSDBalance(myWalletAddress);
    if (aUsdBalance.eq(0)) {
        //Since we are on sandbox we can fund our account with some fake money
        let response = await liminalMarket.fundSandboxAccount(async (obj) => {
            console.log('funded', obj)
        })
    }

    //check if the market is open
    let isOpen = await liminalMarket.isMarketOpen();
    if (isOpen) {
        //lets buy $50 of AAPL stock. Amount is in Wei, so $50 = 50 * 10**18
        await liminalMarket.buySecurityToken('AAPL', ethers.util.toWei(50));

        //or sell all of my Apple stock
        const aaplQuantity = await liminalMarket.getSecurityTokenQuantity('AAPL');
        if (aaplQuantity.gt(0)) {
            //quantity is in Wei, so 1.23 shares of AAPL = 123 * 10**16
            await liminalMarket.sellSecurityToken('AAPL', aaplQuantity);
        }        
    }
    
    //retrieve all available symbols available on Liminal.market
    const securityTokens = await liminalMarket.getSymbols();
    console.log('All symbols available', securityTokens);
    
    //retrieve my positions
    const positions = await liminalMarket.getPositions();
    console.log('My positions', positions);
    
    //retrieve the address of a security token
    const securityTokenAddress = await liminalMarket.getSecurityTokenAddress('AAPL')
    console.log('address', securityTokenAddress);    

```

---
_Source: https://npm.io/package/liminal.market · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
